Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
Signed-off-by: Marius Sincovici <marius.sincovici@nordsec.com>
  • Loading branch information
mariusSincovici committed Jan 22, 2025
1 parent 7351476 commit 85c0b43
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions test/qa/lib/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def capture_traffic(connection_settings, duration: int=5) -> str:

try:
# generate some traffic
generate_traffic(repeat=5)
generate_traffic(retry=5)
except Exception as e: # noqa: BLE001
logging.log(f"capture_traffic exception: {e}")
logging.log(t_connect.packets)
Expand Down Expand Up @@ -254,13 +254,5 @@ def get_external_device_ip() -> str:
return requests.get(API_EXTERNAL_IP, timeout=5).json().get("ip")


def generate_traffic(address = "https://nordvpn.com", timeout=1, repeat=1):
for _ in range(0, max(repeat, 1)):
try:
req = urllib.request.Request(address, method="HEAD")
urllib.request.urlopen(req, timeout=timeout)
except Exception as e: # noqa: BLE001
print(f"generate_traffic FAIL: {e}")
time.sleep(0.5)


def generate_traffic(retry=1):
_is_dns_resolvable(domain="nordvpn.com", retry=retry)

0 comments on commit 85c0b43

Please sign in to comment.