Skip to content

Commit

Permalink
🌱Add few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yrs147 committed Jul 15, 2024
1 parent ef4cf1d commit bb83b4a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions controllers/hcloudmachinetemplate_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

})
Expand All @@ -314,3 +325,7 @@ var _ = Describe("HCloudMachineTemplateReconciler", func() {

})
})

func createPlacementGroupName(name string) *string {
return &name
}

0 comments on commit bb83b4a

Please sign in to comment.