Skip to content

Commit

Permalink
CI: make netpol test more robust and verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Jun 9, 2020
1 parent 8e044b6 commit 3d133e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ def test_singleuser_netpol(api_request, jupyter_user, request_data):

c = subprocess.run([
"kubectl", "exec", pod_name, "--",
"wget", "--quiet", "--tries=1", "--timeout=3", allowed_url,
"wget", "--quiet", "--tries=3", "--timeout=3", allowed_url,
])
assert c.returncode == 0, "Unable to get allowed domain"
assert c.returncode == 0, f"Network issue: access to '{blocked_url}' was supposed to be allowed"

c = subprocess.run([
"kubectl", "exec", pod_name, "--",
"wget", "--quiet", "--server-response", "-O-", "--tries=1", "--timeout=3", blocked_url,
"wget", "--quiet", "--server-response", "-O-", "--tries=3", "--timeout=3", blocked_url,
])
assert c.returncode > 0, "Blocked domain was allowed"
assert c.returncode > 0, f"Network issue: access to '{blocked_url}' was supposed to be denied"

finally:
_delete_server(api_request, jupyter_user, request_data["test_timeout"])
Expand Down

0 comments on commit 3d133e4

Please sign in to comment.