Skip to content

Commit

Permalink
Update builder names to reflect new import path
Browse files Browse the repository at this point in the history
  • Loading branch information
killianmuldoon committed Sep 23, 2021
1 parent 12d7adc commit 34f3fd6
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 202 deletions.
42 changes: 21 additions & 21 deletions controllers/topology/blueprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ func TestGetBlueprint(t *testing.T) {

// The following is a block creating a number of objects for use in the test cases.

infraClusterTemplate := builder.NewInfrastructureClusterTemplateBuilder(metav1.NamespaceDefault, "infraclustertemplate1").
infraClusterTemplate := builder.InfrastructureClusterTemplate(metav1.NamespaceDefault, "infraclustertemplate1").
Build()
controlPlaneTemplate := builder.NewControlPlaneTemplateBuilder(metav1.NamespaceDefault, "controlplanetemplate1").
controlPlaneTemplate := builder.ControlPlaneTemplate(metav1.NamespaceDefault, "controlplanetemplate1").
Build()

controlPlaneInfrastructureMachineTemplate := builder.NewInfrastructureMachineTemplateBuilder(metav1.NamespaceDefault, "controlplaneinframachinetemplate1").
controlPlaneInfrastructureMachineTemplate := builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "controlplaneinframachinetemplate1").
Build()
controlPlaneTemplateWithInfrastructureMachine := builder.NewControlPlaneTemplateBuilder(metav1.NamespaceDefault, "controlplanetempaltewithinfrastructuremachine1").
controlPlaneTemplateWithInfrastructureMachine := builder.ControlPlaneTemplate(metav1.NamespaceDefault, "controlplanetempaltewithinfrastructuremachine1").
WithInfrastructureMachineTemplate(controlPlaneInfrastructureMachineTemplate).
Build()

workerInfrastructureMachineTemplate := builder.NewInfrastructureMachineTemplateBuilder(metav1.NamespaceDefault, "workerinframachinetemplate1").
workerInfrastructureMachineTemplate := builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "workerinframachinetemplate1").
Build()
workerBootstrapTemplate := builder.NewBootstrapTemplateBuilder(metav1.NamespaceDefault, "workerbootstraptemplate1").
workerBootstrapTemplate := builder.BootstrapTemplate(metav1.NamespaceDefault, "workerbootstraptemplate1").
Build()
machineDeployment := builder.NewMachineDeploymentClassBuilder(metav1.NamespaceDefault, "machinedeployment1").
machineDeployment := builder.MachineDeploymentClass(metav1.NamespaceDefault, "machinedeployment1").
WithClass("workerclass1").
WithLabels(map[string]string{"foo": "bar"}).
WithAnnotations(map[string]string{"a": "b"}).
Expand All @@ -78,14 +78,14 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Fails if ClusterClass does not have reference to the InfrastructureClusterTemplate",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "clusterclass1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass1").
// No InfrastructureClusterTemplate reference!
Build(),
wantErr: true,
},
{
name: "Fails if ClusterClass references an InfrastructureClusterTemplate that does not exist",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "clusterclass1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
Build(),
objects: []client.Object{
Expand All @@ -95,7 +95,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Fails if ClusterClass does not have reference to the ControlPlaneTemplate",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
// No ControlPlaneTemplate reference!
Build(),
Expand All @@ -106,7 +106,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Fails if ClusterClass does not have reference to the ControlPlaneTemplate",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
Build(),
Expand All @@ -118,7 +118,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Should read a ClusterClass without worker classes",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
Build(),
Expand All @@ -127,7 +127,7 @@ func TestGetBlueprint(t *testing.T) {
controlPlaneTemplate,
},
want: &scope.ClusterBlueprint{
ClusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
Build(),
Expand All @@ -140,7 +140,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Should read a ClusterClass referencing an InfrastructureMachineTemplate for the ControlPlane (but without any worker class)",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplateWithInfrastructureMachine).
WithControlPlaneInfrastructureMachineTemplate(controlPlaneInfrastructureMachineTemplate).
Expand All @@ -151,7 +151,7 @@ func TestGetBlueprint(t *testing.T) {
controlPlaneInfrastructureMachineTemplate,
},
want: &scope.ClusterBlueprint{
ClusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplateWithInfrastructureMachine).
WithControlPlaneInfrastructureMachineTemplate(controlPlaneInfrastructureMachineTemplate).
Expand All @@ -166,7 +166,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Fails if ClusterClass references an InfrastructureMachineTemplate for the ControlPlane that does not exist",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
WithControlPlaneInfrastructureMachineTemplate(controlPlaneInfrastructureMachineTemplate).
Expand All @@ -180,7 +180,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Should read a ClusterClass with a MachineDeploymentClass",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
WithWorkerMachineDeploymentClasses(mds).
Expand All @@ -192,7 +192,7 @@ func TestGetBlueprint(t *testing.T) {
workerBootstrapTemplate,
},
want: &scope.ClusterBlueprint{
ClusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
WithWorkerMachineDeploymentClasses(mds).
Expand All @@ -215,7 +215,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Fails if ClusterClass has a MachineDeploymentClass referencing a BootstrapTemplate that does not exist",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
WithWorkerMachineDeploymentClasses(mds).
Expand All @@ -230,7 +230,7 @@ func TestGetBlueprint(t *testing.T) {
},
{
name: "Fails if ClusterClass has a MachineDeploymentClass referencing a InfrastructureMachineTemplate that does not exist",
clusterClass: builder.NewClusterClassBuilder(metav1.NamespaceDefault, "class1").
clusterClass: builder.ClusterClass(metav1.NamespaceDefault, "class1").
WithInfrastructureClusterTemplate(infraClusterTemplate).
WithControlPlaneTemplate(controlPlaneTemplate).
WithWorkerMachineDeploymentClasses(mds).
Expand All @@ -249,7 +249,7 @@ func TestGetBlueprint(t *testing.T) {
g := NewWithT(t)

// Set up a cluster using the ClusterClass, if any.
cluster := builder.NewClusterBuilder(metav1.NamespaceDefault, "cluster1").Build()
cluster := builder.Cluster(metav1.NamespaceDefault, "cluster1").Build()
if tt.clusterClass != nil {
cluster.Spec.Topology = &clusterv1.Topology{
Class: tt.clusterClass.Name,
Expand Down
Loading

0 comments on commit 34f3fd6

Please sign in to comment.