@@ -421,13 +421,11 @@ func TestRawPacketDropMetricAccuracyWithReload(t *testing.T) {
421421 }, ruleID )
422422 }
423423
424- runPings := func (wrapper * dockerCmdWrapper , host string , count int ) {
424+ emitPackets := func (wrapper * dockerCmdWrapper , host string , count int ) {
425425 t .Helper ()
426- cmd := wrapper .Command ("ping" , []string {
427- "-c" , strconv .Itoa (count ),
428- "-i" , "1" ,
429- "-W" , "1" ,
430- host ,
426+ cmd := wrapper .Command ("sh" , []string {
427+ "-c" ,
428+ fmt .Sprintf (`i=1; while [ $i -le %d ]; do echo test | nc -u -w1 %s 53; if [ $i -lt %d ]; then sleep 1; fi; i=$((i+1)); done` , count , host , count ),
431429 }, []string {})
432430 _ , _ = cmd .CombinedOutput ()
433431 }
@@ -512,17 +510,17 @@ func TestRawPacketDropMetricAccuracyWithReload(t *testing.T) {
512510 time .Sleep (1 * time .Second )
513511
514512 // 4) 3 pings in container A async
515- go runPings (cmdWrapperA , pingHost , pingCount )
513+ go emitPackets (cmdWrapperA , pingHost , pingCount )
516514
517515 // 5) reload with a second rule on another container (free trigger, different filter)
518516 reloadPolicy ([]* rules.RuleDefinition {rule2 , rule1 })
519517 triggerIsolation (cmdWrapperB , ruleID2 )
520518
521519 // 6) add some pings in container B
522- go runPings (cmdWrapperB , "1.1.1.1" , 2 )
520+ go emitPackets (cmdWrapperB , "1.1.1.1" , 2 )
523521
524522 // 7) 3 more pings in container A
525- runPings (cmdWrapperA , pingHost , pingCount )
523+ emitPackets (cmdWrapperA , pingHost , pingCount )
526524 // wait until they have all been processed
527525 time .Sleep (2 * time .Second )
528526
0 commit comments