Skip to content

Commit

Permalink
Merge pull request #203 from NordSecurity/mmisiunas/natlab_tcpdump_un…
Browse files Browse the repository at this point in the history
…buffered_output

Fix flaky natlab's tests with tcpdump
  • Loading branch information
matislovas authored Nov 13, 2023
2 parents 387eff0 + 020b432 commit a662d77
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
14 changes: 13 additions & 1 deletion nat-lab/tests/test_direct_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,19 @@ async def test_infinite_stun_loop(setup_params: List[SetupParameters]) -> None:
# 3478 and 3479 are STUN ports in natlab containers
tcpdump = await exit_stack.enter_async_context(
alpha_connection.create_process(
["tcpdump", "-i", "any", "(", "port", "3478", "or", "3479", ")"]
[
"tcpdump",
"--immediate-mode",
"-l",
"-i",
"any",
"(",
"port",
"3478",
"or",
"3479",
")",
]
).run()
)
await asyncio.sleep(5)
Expand Down
15 changes: 13 additions & 2 deletions nat-lab/tests/test_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,18 +735,29 @@ async def test_dns_duplicate_requests_on_multiple_forward_servers() -> None:

process = await exit_stack.enter_async_context(
connection_alpha.create_process(
["tcpdump", "-ni", "eth0", "udp", "and", "port", "53", "-l"]
[
"tcpdump",
"--immediate-mode",
"-ni",
"eth0",
"udp",
"and",
"port",
"53",
"-l",
]
).run()
)
await asyncio.sleep(1)

await client_alpha.enable_magic_dns([FIRST_DNS_SERVER, SECOND_DNS_SERVER])
await asyncio.sleep(1)

await testing.wait_long(
connection_alpha.create_process(
["nslookup", "google.com", config.LIBTELIO_DNS_IPV4]
).execute()
)

await asyncio.sleep(1)

tcpdump_stdout = process.get_stdout()
Expand Down

0 comments on commit a662d77

Please sign in to comment.