Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/network/network_policy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def allow_all_http_ports(unprivileged_client, namespace_1):


@pytest.fixture()
def allow_single_http_port(unprivileged_client, namespace_1):
def single_http_port_net_policy(unprivileged_client, namespace_1):
Comment thread
azhivovk marked this conversation as resolved.
Comment thread
azhivovk marked this conversation as resolved.
with ApplyNetworkPolicy(
name="allow-single-http-port",
namespace=namespace_1.name,
Expand Down
13 changes: 9 additions & 4 deletions tests/network/network_policy/test_network_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def test_network_policy_deny_all_http(
)


@pytest.mark.usefixtures("allow_single_http_port")
@pytest.mark.order(before="test_network_policy_allow_all_http")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
@pytest.mark.polarion("CNV-2775")
@pytest.mark.single_nic
Expand All @@ -42,14 +41,19 @@ def test_network_policy_allow_single_http_port(
network_policy_vma,
network_policy_vmb,
admin_client,
single_http_port_net_policy,
):
pod_ips = network_policy_vma.vmi.get_virt_launcher_pod(privileged_client=admin_client).instance.status.podIPs
for pod_ip_entry in pod_ips:
dst_ip = pod_ip_entry["ip"]
with subtests.test(msg=f"Testing {dst_ip}"):
run_ssh_commands(
host=network_policy_vmb.ssh_exec,
commands=[shlex.split(format_curl_command(ip_address=dst_ip, port=TEST_PORTS[0], head=True))],
commands=[
shlex.split(
format_curl_command(ip_address=dst_ip, port=single_http_port_net_policy.ports[0], head=True)
)
],
)

with pytest.raises(CommandExecFailed):
Expand All @@ -59,7 +63,6 @@ def test_network_policy_allow_single_http_port(
)


@pytest.mark.usefixtures("allow_all_http_ports")
@pytest.mark.polarion("CNV-2774")
@pytest.mark.single_nic
@pytest.mark.s390x
Expand All @@ -68,6 +71,7 @@ def test_network_policy_allow_all_http(
network_policy_vma,
network_policy_vmb,
admin_client,
allow_all_http_ports,
Comment thread
azhivovk marked this conversation as resolved.
):
pod_ips = network_policy_vma.vmi.get_virt_launcher_pod(privileged_client=admin_client).instance.status.podIPs
for pod_ip_entry in pod_ips:
Expand All @@ -76,6 +80,7 @@ def test_network_policy_allow_all_http(
run_ssh_commands(
host=network_policy_vmb.ssh_exec,
commands=[
shlex.split(format_curl_command(ip_address=dst_ip, port=port, head=True)) for port in TEST_PORTS
shlex.split(format_curl_command(ip_address=dst_ip, port=port, head=True))
for port in allow_all_http_ports.ports
],
)
Loading