@@ -369,7 +369,7 @@ var _ = Describe("IroncoreMetalMachine Controller", func() {
369369 BeforeEach (func () {
370370 secret = & corev1.Secret {
371371 ObjectMeta : metav1.ObjectMeta {
372- Name : "secret" ,
372+ Name : "secret-test " ,
373373 Namespace : namespace ,
374374 },
375375 Data : map [string ][]byte {
@@ -489,7 +489,6 @@ var _ = Describe("IroncoreMetalMachine Controller", func() {
489489 Expect (k8sClient .Delete (ctx , cluster )).To (Succeed ())
490490 Expect (k8sClient .Delete (ctx , machine )).To (Succeed ())
491491 })
492-
493492 When ("no owner set" , func () {
494493 It ("should pass with empty" , func () {
495494 metalMachineOwner .OwnerReferences = []metav1.OwnerReference {}
@@ -502,10 +501,15 @@ var _ = Describe("IroncoreMetalMachine Controller", func() {
502501 Expect (k8sClient .Delete (ctx , metalMachineOwner )).To (Succeed ())
503502 })
504503 })
505- When ("no cluster label " , func () {
506- It ("should return empty " , func () {
507- metalMachine . Labels = map [ string ] string {}
504+ When ("machine in fail state " , func () {
505+ It ("should return empty" , func () {
506+ stateMachine := true
508507 tmpMAchine := & infrav1alpha1.IroncoreMetalMachine {}
508+ metalMachine .Status .Initialization .Provisioned = & stateMachine
509+ metalMachine .Status .Conditions = append (metalMachine .Status .Conditions , metav1.Condition {
510+ Status : "False" , Type : "NetworkUnavailable" , Reason : "Test" ,
511+ Message : "Test" ,
512+ })
509513 Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (metalMachine ), tmpMAchine )).NotTo (HaveOccurred ())
510514 metalMachine .ObjectMeta = tmpMAchine .ObjectMeta
511515 Expect (k8sClient .Update (ctx , metalMachine )).To (Succeed ())
@@ -516,13 +520,10 @@ var _ = Describe("IroncoreMetalMachine Controller", func() {
516520 Expect (out ).To (Equal (ctrl.Result {Requeue : false , RequeueAfter : 5 * time .Second }))
517521 })
518522 })
519- When ("machine in fail state " , func () {
520- It ("should return empty" , func () {
521- stateMachine := true
523+ When ("no cluster label " , func () {
524+ It ("should return empty " , func () {
525+ metalMachine . Labels = map [ string ] string {}
522526 tmpMAchine := & infrav1alpha1.IroncoreMetalMachine {}
523- metalMachine .Status .Initialization .Provisioned = & stateMachine
524- metalMachine .Status .Conditions = append (metalMachine .Status .Conditions , metav1.Condition {Status : "False" , Type : "NetworkUnavailable" , Reason : "Test" ,
525- Message : "Test" })
526527 Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (metalMachine ), tmpMAchine )).NotTo (HaveOccurred ())
527528 metalMachine .ObjectMeta = tmpMAchine .ObjectMeta
528529 Expect (k8sClient .Update (ctx , metalMachine )).To (Succeed ())
0 commit comments