@@ -12,8 +12,10 @@ import (
1212)
1313
1414const (
15- defaultNetInt = `eth0` // default network interface
16- defaultSnapLen = 1024 // default size of the packet snap length
15+ defaultNetInt = `eth0` // default network interface
16+ defaultSnapLen = 1024 // default size of the packet snap length
17+ ephemeralContainersExtraSeconds = 23 // fixed extra time given for the ephemeral containers to come online
18+ attemptsMultiplier = 3 // increase the attempts to ensure that we send three times the packets
1719)
1820
1921// RunUDPTest - runs a UDP test
@@ -114,7 +116,7 @@ func (e *Engine) RunUDPTest(
114116 string (te .Protocol ),
115117 te .Attempts ,
116118 networkInterface ,
117- te .TimeoutSeconds + 5 , // add 5 seconds for the Container to come online
119+ te .TimeoutSeconds ,
118120 )
119121 if err != nil {
120122 return fmt .Errorf ("failed to build sniffer ephemeral container for test %s: %w" , te .Name , err )
@@ -128,7 +130,7 @@ func (e *Engine) RunUDPTest(
128130 strconv .Itoa (te .TargetPort ),
129131 string (te .Protocol ),
130132 msg ,
131- te .Attempts * 3 , // increase the attempts to ensure that we send three times the packets
133+ te .Attempts * attemptsMultiplier ,
132134 )
133135 if err != nil {
134136 return fmt .Errorf ("unable to build ephemeral scanner container for test %s: %w" , te .Name , err )
@@ -152,7 +154,7 @@ func (e *Engine) RunUDPTest(
152154 exitCodeSnifferCtr , err := e .Service .GetExitStatusOfEphemeralContainer (
153155 ctx ,
154156 snifferContainerName ,
155- time .Duration (te .TimeoutSeconds )* time .Second ,
157+ time .Duration (te .TimeoutSeconds + ephemeralContainersExtraSeconds )* time .Second ,
156158 dstPod .Name ,
157159 dstPod .Namespace ,
158160 )
@@ -174,7 +176,7 @@ func (e *Engine) RunUDPTest(
174176 // get the exit status of the scanner container
175177 exitCodeScanner , err := e .Service .GetExitStatusOfEphemeralContainer (
176178 ctx , scannerContainerName ,
177- time .Duration (te .TimeoutSeconds + 10 )* time .Second ,
179+ time .Duration (te .TimeoutSeconds + ephemeralContainersExtraSeconds )* time .Second ,
178180 srcPod .Name ,
179181 srcPod .Namespace ,
180182 )
0 commit comments