@@ -32,7 +32,6 @@ import (
3232 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333 "k8s.io/apimachinery/pkg/fields"
3434 "k8s.io/apimachinery/pkg/labels"
35- "k8s.io/klog/v2"
3635)
3736
3837const (
@@ -238,6 +237,8 @@ var _ = Describe("LACP Status Relay", Ordered, Label(tsparams.LabelSuite), Conti
238237 netparam .DefaultTimeout , pfstatus .GetPfStatusConfigurationGVR ())
239238 Expect (err ).ToNot (HaveOccurred (), "Failed to clean PFLACPMonitor" )
240239
240+ waitForAllPFStatusRelayDaemonsetsDeleted ()
241+
241242 By ("Deleting client-bond pod" )
242243 bondedClientPod , err := pod .Pull (APIClient , bondedClientPodName , tsparams .TestNamespaceName )
243244 if err == nil {
@@ -462,6 +463,8 @@ var _ = Describe("LACP Status Relay", Ordered, Label(tsparams.LabelSuite), Conti
462463 err := deletePFLACPMonitor (pfLacpMonitorName )
463464 Expect (err ).ToNot (HaveOccurred (), "Failed to delete PFLACPMonitor CRD" )
464465
466+ waitForAllPFStatusRelayDaemonsetsDeleted ()
467+
465468 By ("Verify that the VFs interfaces remain in disabled state after CRD deletion" )
466469 Eventually (func () error {
467470 return verifyVFsStateOnInterface (worker0NodeName , secondaryInterface0 , "disable" )
@@ -644,6 +647,8 @@ var _ = Describe("LACP Status Relay", Ordered, Label(tsparams.LabelSuite), Conti
644647 err = namespace .NewBuilder (APIClient , NetConfig .PFStatusRelayOperatorNamespace ).CleanObjects (
645648 netparam .DefaultTimeout , pfstatus .GetPfStatusConfigurationGVR ())
646649 Expect (err ).ToNot (HaveOccurred (), "Failed to clean PFLACPMonitor" )
650+
651+ waitForAllPFStatusRelayDaemonsetsDeleted ()
647652 })
648653
649654 It ("Verify bond active-backup recovery when PF LACP failure disables VF" , reportxml .ID ("83320" ),
@@ -1202,6 +1207,29 @@ func deletePFLACPMonitor(monitorName string) error {
12021207 return nil
12031208}
12041209
1210+ func waitForAllPFStatusRelayDaemonsetsDeleted () {
1211+ By ("Waiting for all PF status relay daemonsets to be deleted" )
1212+
1213+ Eventually (func () bool {
1214+ daemonsetList , err := APIClient .DaemonSets (NetConfig .PFStatusRelayOperatorNamespace ).List (
1215+ context .TODO (), metav1.ListOptions {})
1216+ if err != nil {
1217+ By (fmt .Sprintf ("Error listing daemonsets: %v" , err ))
1218+
1219+ return false
1220+ }
1221+
1222+ if len (daemonsetList .Items ) > 0 {
1223+ By (fmt .Sprintf ("Daemonsets still exist: %d remaining" , len (daemonsetList .Items )))
1224+
1225+ return false
1226+ }
1227+
1228+ return true
1229+ }, 1 * time .Minute , 5 * time .Second ).Should (BeTrue (),
1230+ "PF status relay daemonsets should be deleted" )
1231+ }
1232+
12051233func verifyPFHasNoVFsLogs (nodeName , targetInterface string ) error {
12061234 By (fmt .Sprintf ("Verifying PFLACPMonitor logs show 'pf has no VFs' for interface %s" , targetInterface ))
12071235
@@ -1521,7 +1549,7 @@ func setLACPBlockFilterOnInterface(credentials *sriovenv.SwitchCredentials, enab
15211549
15221550 lacpInterfaces , err := NetConfig .GetSwitchLagNames ()
15231551 if err != nil {
1524- klog . V ( 90 ). Infof ("Failed to get switch LAG names: %v" , err )
1552+ By ( fmt . Sprintf ("Failed to get switch LAG names: %v" , err ) )
15251553 }
15261554
15271555 Expect (err ).ToNot (HaveOccurred (), "Failed to get switch LAG names" )
@@ -1587,17 +1615,17 @@ func validateBondedTCPTraffic(clientPod *pod.Builder) {
15871615 output , err := clientPod .ExecCommand (command , clientPod .Definition .Spec .Containers [0 ].Name )
15881616
15891617 // Log the output for debugging regardless of command success/failure
1590- By (fmt .Sprintf ("testcmd output: %s" , output .String ()))
1618+ By (fmt .Sprintf ("TCP traffic test output from pod %s: \n %s" , clientPod . Definition . Name , output .String ()))
15911619
15921620 // Focus on network connectivity rather than testcmd exit code
15931621 // testcmd can be strict and fail even when network is working
15941622 if err != nil {
1595- By (fmt .Sprintf ("testcmd exited with error (expected for strict validation) , output: %s" , output .String ()))
1623+ By (fmt .Sprintf ("testcmd exited with error: %v , output: %s" , err , output .String ()))
15961624 }
15971625
1598- By ("Verify bonded interface connectivity has no packet loss" )
1626+ By ("Verifying bonded interface connectivity has no packet loss" )
15991627 Expect (output .String ()).Should (ContainSubstring ("0 packet loss" ),
1600- fmt .Sprintf ("Bonded interface %s should have 0 packet loss" , bondTestInterface ))
1628+ fmt .Sprintf ("Bonded interface %s should have 0 packet loss. Full output: \n %s " , bondTestInterface , output . String () ))
16011629}
16021630
16031631func getPFLACPMonitorPod (nodeName string ) (* pod.Builder , error ) {
0 commit comments