Skip to content

Commit 919c9d1

Browse files
address comments
1 parent 32d4165 commit 919c9d1

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ generate-go-core: $(CONTROLLER_GEN) $(CONVERSION_GEN)
189189
$(CONTROLLER_GEN) \
190190
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
191191
paths=./api/... \
192-
paths=./cmd/clusterctl/api/... \
193-
paths=./cmd/clusterctl/pkg/internal/test/providers/...
192+
paths=./cmd/clusterctl/...
194193
$(CONVERSION_GEN) \
195194
--input-dirs=./api/v1alpha2 \
196195
--output-file-base=zz_generated.conversion \

cmd/clusterctl/pkg/internal/test/fake_objects.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ func (f *FakeMachine) Objs(cluster *clusterv1.Cluster, generateCerts bool, machi
742742
// Labels: cluster.x-k8s.io/cluster-name=cluster, Added by the machine controller (see below) -- RECONCILED
743743
},
744744
Status: fakebootstrap.DummyBootstrapConfigStatus{
745-
DataSecretName: bootstrapDataSecretName,
745+
DataSecretName: &bootstrapDataSecretName,
746746
},
747747
}
748748

@@ -880,7 +880,10 @@ func (f *FakeMachine) Objs(cluster *clusterv1.Cluster, generateCerts bool, machi
880880
// setUID assigns a UID to the object, so test objects are uniquely identified.
881881
// NB. In order to make debugging easier we are using a human readable, deterministic string (instead of a random UID).
882882
func setUID(obj runtime.Object) {
883-
accessor, _ := meta.Accessor(obj)
883+
accessor, err := meta.Accessor(obj)
884+
if err != nil {
885+
panic(fmt.Sprintf("failde to get accessor for test object: %v", err))
886+
}
884887
uid := fmt.Sprintf("%s, %s/%s", obj.GetObjectKind().GroupVersionKind().String(), accessor.GetNamespace(), accessor.GetName())
885888
accessor.SetUID(types.UID(uid))
886889
}
@@ -893,12 +896,12 @@ func FakeCustomResourceDefinition(group string, kind string, versions ...string)
893896
APIVersion: "CustomResourceDefinition",
894897
},
895898
ObjectMeta: metav1.ObjectMeta{
896-
Name: fmt.Sprintf("%s.%s", strings.ToLower(kind), group),
899+
Name: fmt.Sprintf("%s.%s", strings.ToLower(kind), group), //NB. this technically should use plural(kind), but for the sake of test what really matters is to generate a unique name
897900
Labels: map[string]string{
898901
clusterctlv1.ClusterctlLabelName: "",
899902
},
900903
},
901-
Spec: apiextensionslv1.CustomResourceDefinitionSpec{
904+
Spec: apiextensionslv1.CustomResourceDefinitionSpec{ //NB. the spec contains only what is strictly required by the move test
902905
Group: group,
903906
Names: apiextensionslv1.CustomResourceDefinitionNames{
904907
Kind: kind,

cmd/clusterctl/pkg/internal/test/providers/bootstrap/dummy_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525

2626
type DummyBootstrapConfigStatus struct {
2727
// +optional
28-
DataSecretName string `json:"dataSecretName,omitempty"` //TODO: capire perche con *string fallisce...
28+
DataSecretName *string `json:"dataSecretName,omitempty"`
2929
}
3030

3131
// +kubebuilder:object:root=true

cmd/clusterctl/pkg/internal/test/providers/bootstrap/zz_generated.deepcopy.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/clusterctl/pkg/internal/test/providers/infrastructure/groupversion_info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
// +kubebuilder:object:generate=true
18-
// +groupName=infrastructure.clusterctl.cluster.x-k8s.io
18+
// +groupName=infrastructure.cluster.x-k8s.io
1919
package infrastructure
2020

2121
import (

0 commit comments

Comments
 (0)