diff --git a/controllers/hcloudmachinetemplate_controller_test.go b/controllers/hcloudmachinetemplate_controller_test.go index 9bda55d1c..e897498a1 100644 --- a/controllers/hcloudmachinetemplate_controller_test.go +++ b/controllers/hcloudmachinetemplate_controller_test.go @@ -289,10 +289,21 @@ var _ = Describe("HCloudMachineTemplateReconciler", func() { It("should prevent updating Image name", func() { Expect(testEnv.Get(ctx, key, machineTemplate)).To(Succeed()) - hcloudMachineTemplate.Spec.Template.Spec.Type = "cpx32" + hcloudMachineTemplate.Spec.Template.Spec.ImageName = "fedora-control-plane" + Expect(testEnv.Client.Update(ctx, hcloudMachineTemplate)).ToNot(Succeed()) + + }) + It("should prevent updating SSHKey", func() { + Expect(testEnv.Get(ctx, key, machineTemplate)).To(Succeed()) + + hcloudMachineTemplate.Spec.Template.Spec.SSHKeys = []infrav1.SSHKey{{Name: "ssh-key-1"}} Expect(testEnv.Client.Update(ctx, hcloudMachineTemplate)).ToNot(Succeed()) - hcloudMachineTemplate.Spec.Template.Spec.ImageName = "fedor-control-plane" + }) + It("should prevent updating PlacementGroups", func() { + Expect(testEnv.Get(ctx, key, machineTemplate)).To(Succeed()) + + hcloudMachineTemplate.Spec.Template.Spec.PlacementGroupName = createPlacementGroupName("placement-group-1") Expect(testEnv.Client.Update(ctx, hcloudMachineTemplate)).ToNot(Succeed()) }) @@ -314,3 +325,7 @@ var _ = Describe("HCloudMachineTemplateReconciler", func() { }) }) + +func createPlacementGroupName(name string) *string { + return &name +}