Skip to content

Commit

Permalink
No annotation test passes
Browse files Browse the repository at this point in the history
When you don't have a HetznerBareMetalHost annotation in
the HetznerBareMetalHost

Signed-off-by: Aniruddha Basak <aniruddha.basak@syself.com>
  • Loading branch information
aniruddha2000 committed Oct 11, 2023
1 parent 442fde2 commit e0a1b2c
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions controllers/hetznerbaremetalremediation_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var _ = Describe("HetznerBareMetalRemediationReconciler", func() {
ClusterName: capiCluster.Name,
InfrastructureRef: corev1.ObjectReference{
APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1",
Kind: "HCloudMachine",
Kind: "HetznerBareMetalMachine",
Name: hetznerBaremetalMachineName,
Namespace: testNs.Name,
},
Expand Down Expand Up @@ -227,25 +227,19 @@ var _ = Describe("HetznerBareMetalRemediationReconciler", func() {
})

AfterEach(func() {
Expect(testEnv.Cleanup(ctx, testNs, hetznerBareMetalRemediation, hetznerCluster, hetznerBaremetalMachine,
host, hetznerSecret, bootstrapSecret, capiMachine, capiCluster)).To(Succeed())
Expect(testEnv.Cleanup(ctx, testNs, capiCluster, capiMachine, hetznerCluster,
hetznerSecret, osSSHSecret, rescueSSHSecret, bootstrapSecret)).To(Succeed())
})

Context("Basic test", func() {
Context("HetznerBaremetalHost doesn't exist", func() {
// BeforeEach(func() {
// hetznerBaremetalMachine.Annotations = map[string]string{
// infrav1.HostAnnotation: fmt.Sprintf("%s/%s", testNs.Name, hostName),
// }
// Expect(testEnv.Create(ctx, hetznerBaremetalMachine)).To(Succeed())
// })

// AfterEach(func() {
// Expect(testEnv.Cleanup(ctx, hetznerBaremetalMachine)).To(Succeed())
// })
AfterEach(func() {
Expect(testEnv.Cleanup(ctx, hetznerBareMetalRemediation, hetznerBaremetalMachine)).To(Succeed())
})

FIt("Should set MachineOwnerRemediatedCondition on capiMachine as there is no host annotation on hetznerBaremetalMachine", func() {
Expect(testEnv.Create(ctx, hetznerBaremetalMachine)).To(Succeed())
Expect(testEnv.Create(ctx, hetznerBareMetalRemediation)).To(Succeed())

Eventually(func() bool {
if err := testEnv.Get(ctx, capiMachineKey, capiMachine); err != nil {
Expand Down

0 comments on commit e0a1b2c

Please sign in to comment.