Skip to content

Commit

Permalink
Remove IPv6-only on IPv6 only infra test (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 authored Nov 8, 2024
1 parent 528d459 commit 92828c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 78 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/integration-informing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ jobs:
TEST_FLAVOR: ${{ matrix.patch }}
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
run: |
# IPv6-only is only supported on moonray
if [[ "${{ matrix.patch }}" == "moonray" ]]; then
export TEST_IPV6_ONLY="true"
fi
cd tests/integration && sg lxd -c 'tox -e integration'
- name: Prepare inspection reports
if: failure()
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ jobs:
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ${{ matrix.os }}
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
# Test the latest (up to) 6 releases for the flavour
# TODO(ben): upgrade nightly to run all flavours
TEST_VERSION_UPGRADE_CHANNELS: "recent 6 classic"
# Upgrading from 1.30 is not supported.
TEST_VERSION_UPGRADE_MIN_RELEASE: "1.31"
run: |
cd tests/integration && sg lxd -c 'tox -e integration'
- name: Prepare inspection reports
Expand Down
74 changes: 0 additions & 74 deletions tests/integration/tests/test_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Copyright 2024 Canonical, Ltd.
#
import logging
import os
from ipaddress import IPv4Address, IPv6Address, ip_address
from typing import List

Expand Down Expand Up @@ -62,10 +61,6 @@ def test_dualstack(instances: List[harness.Instance]):
@pytest.mark.node_count(3)
@pytest.mark.disable_k8s_bootstrapping()
@pytest.mark.network_type("dualstack")
@pytest.mark.skipif(
os.getenv("TEST_IPV6_ONLY") in ["false", None],
reason="IPv6 is currently only supported for moonray/calico",
)
def test_ipv6_only_on_dualstack_infra(instances: List[harness.Instance]):
main = instances[0]
joining_cp = instances[1]
Expand Down Expand Up @@ -126,72 +121,3 @@ def test_ipv6_only_on_dualstack_infra(instances: List[harness.Instance]):
util.stubbornly(retries=config.DEFAULT_WAIT_RETRIES, delay_s=20).until(
util.ready_nodes(main) == 3
)


@pytest.mark.node_count(3)
@pytest.mark.disable_k8s_bootstrapping()
@pytest.mark.network_type("ipv6")
@pytest.mark.skipif(
os.getenv("TEST_IPV6_ONLY") in ["false", None],
reason="IPv6 is currently only supported for moonray/calico",
)
def test_ipv6_only_on_ipv6_infra(instances: List[harness.Instance]):
main = instances[0]
joining_cp = instances[1]
joining_worker = instances[2]

ipv6_bootstrap_config = (
config.MANIFESTS_DIR / "bootstrap-ipv6-only.yaml"
).read_text()

main.exec(
["k8s", "bootstrap", "--file", "-"],
input=str.encode(ipv6_bootstrap_config),
)

join_token = util.get_join_token(main, joining_cp)
joining_cp.exec(["k8s", "join-cluster", join_token])

join_token_worker = util.get_join_token(main, joining_worker, "--worker")
joining_worker.exec(["k8s", "join-cluster", join_token_worker])

# Deploy nginx with ipv6 service
ipv6_config = (config.MANIFESTS_DIR / "nginx-ipv6-only.yaml").read_text()
main.exec(["k8s", "kubectl", "apply", "-f", "-"], input=str.encode(ipv6_config))
addresses = (
util.stubbornly(retries=5, delay_s=3)
.on(main)
.exec(
[
"k8s",
"kubectl",
"get",
"svc",
"nginx-ipv6",
"-o",
"jsonpath='{.spec.clusterIPs[*]}'",
],
text=True,
capture_output=True,
)
.stdout
)

for ip in addresses.split():
addr = ip_address(ip.strip("'"))
if isinstance(addr, IPv6Address):
address = f"http://[{str(addr)}]"
elif isinstance(addr, IPv4Address):
assert False, "IPv4 address found in IPv6-only cluster"
else:
pytest.fail(f"Unknown IP address type: {addr}")

# need to shell out otherwise this runs into permission errors
util.stubbornly(retries=3, delay_s=1).on(main).exec(
["curl", address], shell=True
)

# This might take a while
util.stubbornly(retries=config.DEFAULT_WAIT_RETRIES, delay_s=20).until(
util.ready_nodes(main) == 3
)

0 comments on commit 92828c5

Please sign in to comment.