@@ -1450,11 +1450,16 @@ func TestReconcilePatchesCandidateAgentWithPoolDiscriminatorLabel(t *testing.T)
14501450 pool := reconcileTestPool ()
14511451 pool .Spec .Agent .Labels [poolLabelKey ] = "worker-32c128g"
14521452 pool .Status .OwnedVMs = []agentforgev1alpha1.OwnedVMStatus {
1453- newOwnedVMStatus ("demo-worker-32c128g-ab12" ),
1453+ {
1454+ Name : "demo-worker-32c128g-ab12" ,
1455+ Phase : phaseProvisioning ,
1456+ MACAddress : "00-50-56-b2-a1-9f" ,
1457+ },
14541458 }
14551459 am := testAgentMachine (testControlPlaneNamespace , testNodePool , "demo/demo-worker" )
14561460 infraEnv := testInfraEnv (testNamespace , testInfraEnvName , "https://example.invalid/discovery.iso" )
14571461 agent := testCandidateAgent (testNamespace , "abcdef12-3456-7890-abcd-ef1234567890" )
1462+ setAgentPrimaryMAC (t , agent , "00:50:56:b2:a1:9f" )
14581463
14591464 k8sClient := fake .NewClientBuilder ().
14601465 WithScheme (scheme ).
@@ -1726,6 +1731,7 @@ func TestAssignedAgentHostnamesUsesVMIdentityBeforeFreeSlot(t *testing.T) {
17261731
17271732 hostnames := assignedAgentHostnames (pool , []AgentInfo {{
17281733 Name : "agent-1" ,
1734+ Hostname : "demo-worker-stale" ,
17291735 BIOSUUID : "22222222-2222-2222-2222-222222222222" ,
17301736 }})
17311737
@@ -2475,6 +2481,13 @@ func setAgentInventoryHostname(t *testing.T, agent *unstructured.Unstructured, h
24752481 }
24762482}
24772483
2484+ func setAgentPrimaryMAC (t * testing.T , agent * unstructured.Unstructured , mac string ) {
2485+ t .Helper ()
2486+ if err := unstructured .SetNestedSlice (agent .Object , []any {map [string ]any {"macAddress" : mac }}, "status" , "inventory" , "interfaces" ); err != nil {
2487+ t .Fatal (err )
2488+ }
2489+ }
2490+
24782491func findCondition (conditions []metav1.Condition , conditionType string ) * metav1.Condition {
24792492 for i := range conditions {
24802493 if conditions [i ].Type == conditionType {
0 commit comments