Skip to content

Commit 4670eca

Browse files
authored
Merge pull request #279 from Venkat-Kunaparaju/timeout
Use test duration for curl and iperf connect timeouts
2 parents 08d58ee + a6645dc commit 4670eca

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

testTypeHttp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ def _create_task_operation(self) -> TaskOperation:
6464
and external_url is not None
6565
)
6666

67+
timeout = int(self.get_duration() * 1.5)
68+
6769
if use_internet:
68-
cmd = f"curl -s -m 30 {external_url}"
70+
cmd = f"curl -s -m {timeout} {external_url}"
6971
expected_string = (
7072
tftbase.get_tft_external_server_string()
7173
or _INTERNET_DEFAULT_SERVER_STRING
@@ -77,7 +79,7 @@ def _check_success_internet(r: host.Result) -> bool:
7779
else:
7880
server_ip = self.get_target_ip()
7981
target_port = self.get_target_port()
80-
cmd = f"curl --fail -s --connect-timeout 5 http://{server_ip}:{target_port}/data"
82+
cmd = f"curl --fail -s --connect-timeout {timeout} http://{server_ip}:{target_port}/data"
8183

8284
def _check_success_podman(r: host.Result) -> bool:
8385
return r.success and r.match(

testTypeIperf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def _create_task_operation(self) -> TaskOperation:
141141
target_port = self.get_target_port()
142142
cmd = f"{IPERF_EXE} -c {server_ip} -p {target_port} --json -t {self.get_duration()}"
143143

144-
if self.ts.test_case_id.info.expects_blocked:
145-
cmd += " --connect-timeout 5000"
144+
connect_timeout_ms = int(self.get_duration() * 1.5 * 1000)
145+
cmd += f" --connect-timeout {connect_timeout_ms}"
146146

147147
if self.test_type == TestType.IPERF_UDP:
148148
cmd += f" {IPERF_UDP_OPT}"

0 commit comments

Comments
 (0)