@@ -12,8 +12,10 @@ import (
12
12
)
13
13
14
14
const (
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
17
19
)
18
20
19
21
// RunUDPTest - runs a UDP test
@@ -114,7 +116,7 @@ func (e *Engine) RunUDPTest(
114
116
string (te .Protocol ),
115
117
te .Attempts ,
116
118
networkInterface ,
117
- te .TimeoutSeconds + 5 , // add 5 seconds for the Container to come online
119
+ te .TimeoutSeconds ,
118
120
)
119
121
if err != nil {
120
122
return fmt .Errorf ("failed to build sniffer ephemeral container for test %s: %w" , te .Name , err )
@@ -128,7 +130,7 @@ func (e *Engine) RunUDPTest(
128
130
strconv .Itoa (te .TargetPort ),
129
131
string (te .Protocol ),
130
132
msg ,
131
- te .Attempts * 3 , // increase the attempts to ensure that we send three times the packets
133
+ te .Attempts * attemptsMultiplier ,
132
134
)
133
135
if err != nil {
134
136
return fmt .Errorf ("unable to build ephemeral scanner container for test %s: %w" , te .Name , err )
@@ -152,7 +154,7 @@ func (e *Engine) RunUDPTest(
152
154
exitCodeSnifferCtr , err := e .Service .GetExitStatusOfEphemeralContainer (
153
155
ctx ,
154
156
snifferContainerName ,
155
- time .Duration (te .TimeoutSeconds )* time .Second ,
157
+ time .Duration (te .TimeoutSeconds + ephemeralContainersExtraSeconds )* time .Second ,
156
158
dstPod .Name ,
157
159
dstPod .Namespace ,
158
160
)
@@ -174,7 +176,7 @@ func (e *Engine) RunUDPTest(
174
176
// get the exit status of the scanner container
175
177
exitCodeScanner , err := e .Service .GetExitStatusOfEphemeralContainer (
176
178
ctx , scannerContainerName ,
177
- time .Duration (te .TimeoutSeconds + 10 )* time .Second ,
179
+ time .Duration (te .TimeoutSeconds + ephemeralContainersExtraSeconds )* time .Second ,
178
180
srcPod .Name ,
179
181
srcPod .Namespace ,
180
182
)
0 commit comments