Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonobuoy e2e nigthly tests #715

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
55d9d80
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
2f1472d
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
46970fa
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
b29871e
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
17681f0
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
7fbd273
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
b9b5e83
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
8484ea3
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
b604ffd
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
040652c
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
d54af78
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
215d574
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
64592ec
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
934fb20
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
b32b134
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
d0958b6
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
41bdf6f
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
8c291d9
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
fd4158c
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
5af23f5
Sonobuoy Nightly Tests
maci3jka Oct 4, 2024
4178e7e
remove summary
maci3jka Oct 7, 2024
35d0e3f
switch to schedule
maci3jka Oct 7, 2024
1412990
make run weekly
maci3jka Oct 7, 2024
6d19b7b
move do shell script
maci3jka Oct 7, 2024
d055eb5
profile fix
maci3jka Oct 7, 2024
dfc6f95
remove comments
maci3jka Oct 7, 2024
df4f771
test1
maci3jka Oct 7, 2024
b1ecb00
test2
maci3jka Oct 7, 2024
c56c149
run full e2e
maci3jka Oct 7, 2024
e1922fa
review fixes
maci3jka Oct 9, 2024
117f5ba
review fixes
maci3jka Oct 13, 2024
90845a2
review fixes
maci3jka Oct 14, 2024
4c4ed97
full tests
maci3jka Oct 14, 2024
a37f187
remove pr run
maci3jka Oct 14, 2024
2d5c44b
add pr run
maci3jka Oct 14, 2024
8938d62
WIP
maci3jka Oct 14, 2024
fc0813a
wip
maci3jka Oct 16, 2024
855cff6
move tests to python
maci3jka Oct 18, 2024
cb68dcf
full test
maci3jka Oct 18, 2024
7d4103e
add types
maci3jka Oct 18, 2024
a5d81c3
added print of status report
maci3jka Oct 20, 2024
0447898
added print of status report
maci3jka Oct 20, 2024
a476b6d
review fixes
maci3jka Oct 21, 2024
7f89bf1
review fixes
maci3jka Oct 22, 2024
9422ce0
Merge branch 'main' into KU-269/sonobuoy-e2e
maci3jka Oct 22, 2024
ccf15bf
artifact name fix
maci3jka Oct 23, 2024
0012858
Merge branch 'main' into KU-269/sonobuoy-e2e
maci3jka Oct 24, 2024
68e7004
workflow quick test
maci3jka Oct 24, 2024
26289fe
add release on cncf report
maci3jka Oct 25, 2024
0107d4a
update cncf reports
maci3jka Oct 28, 2024
3548472
test skip test_mixed_version_join
maci3jka Nov 1, 2024
f675816
fix inspection reports filename
maci3jka Nov 2, 2024
f071e92
test1
maci3jka Nov 4, 2024
d9f7501
test2
maci3jka Nov 4, 2024
53195ac
test3
maci3jka Nov 4, 2024
4e66c59
linter fix
maci3jka Nov 6, 2024
6b38a48
full cncf conformance
maci3jka Nov 6, 2024
b71f703
review fixes
maci3jka Nov 8, 2024
c9f3371
Merge branch 'main' into KU-269/sonobuoy-e2e
maci3jka Nov 8, 2024
8d41794
merge with main
maci3jka Nov 8, 2024
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
25 changes: 23 additions & 2 deletions .github/workflows/nightly-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ name: Nightly Latest/Edge Tests
on:
schedule:
- cron: "0 0 * * *" # Runs every midnight
pull_request: # todo remove before merge

permissions:
contents: read

jobs:
test-integration:
name: Integration Test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.release }}
env:
# todo(mac) e2e works with Cilium to 1.17 remove if after upgrade
TEST_CNCF_E2E: ${{ matrix.release == 'latest/edge/moonray' }}
strategy:
matrix:
os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04"]
arch: ["amd64", "arm64"]
release: ["latest/edge"]
release: ["latest/edge/moonray", "latest/edge/classic", "latest/edge/strict"]
fail-fast: false # TODO: remove once arm64 works

runs-on: ${{ matrix.arch == 'arm64' && 'Ubuntu_ARM64_4C_16G_01' || 'ubuntu-20.04' }}
Expand All @@ -41,6 +45,7 @@ jobs:
TEST_SNAP: ${{ github.workspace }}/build/k8s.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ${{ matrix.os }}
TEST_SNAP_RELEASE: ${{ matrix.release }}
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
Expand All @@ -51,6 +56,11 @@ jobs:
run: |
export PATH="/home/runner/.local/bin:$PATH"
cd tests/integration && sg lxd -c 'tox -vve integration'
- name: Create env variables for artifacts
if: failure()
run: |
echo "os_dash=${{ matrix.os }}" | sed 's/:/-/g' >> $GITHUB_ENV
echo "release_dash=${{ matrix.release }}" | sed 's#/#-#g'>> $GITHUB_ENV
- name: Prepare inspection reports
if: failure()
run: |
Expand All @@ -61,8 +71,19 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ github.workspace }}/inspection-reports.tar.gz
path: ${{ github.workspace }}/inspection-reports_${{ env.os_dash }}_${{ env.release_dash }}_${{ matrix.arch }}.tar.gz
- name: Tmate debugging session
if: ${{ failure() && github.event_name == 'pull_request' }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
- name: Extract CNCF conformance report
if: ${{ failure() && ( env.TEST_CNCF_E2E == 'true' ) }}
working-directory: tests/integration
run: |
tar -xf sonobuoy_e2e.tar.gz --one-top-level
- name: Upload CNCF conformance report artifact
uses: actions/upload-artifact@v4
if: ${{ failure() && ( env.TEST_CNCF_E2E == 'true' ) }}
with:
name: report_sonobuoy_e2e_${{ env.os_dash }}_${{ env.release_dash }}_${{ matrix.arch }}
path: tests/integration/sonobuoy_e2e
4 changes: 4 additions & 0 deletions tests/integration/tests/test_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def test_control_plane_nodes(instances: List[harness.Instance]):
), f"only {cluster_node.id} should be left in cluster"


@pytest.mark.skipif(
os.getenv("TEST_SNAP_RELEASE") in ["latest/edge/classic", "latest/edge/strict"],
reason="Test is breaks on classic and strict",
)
@pytest.mark.node_count(2)
@pytest.mark.snap_versions([util.previous_track(config.SNAP), config.SNAP])
def test_mixed_version_join(instances: List[harness.Instance]):
Expand Down
74 changes: 74 additions & 0 deletions tests/integration/tests/test_cncf_conformace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# Copyright 2024 Canonical, Ltd.
#
import logging
import os
import re
from typing import List

import pytest
from test_util import config, harness, util

LOG = logging.getLogger(__name__)


@pytest.mark.skipif(
os.getenv("TEST_CNCF_E2E") in ["false", None],
reason="Test is long and should be run nightly",
)
@pytest.mark.node_count(2)
def test_cncf_conformance(instances: List[harness.Instance]):
cluster_node = cluster_setup(instances)
install_sonobuoy(cluster_node)

cluster_node.exec(
["./sonobuoy"],
)
cluster_node.exec(
["./sonobuoy", "run", "--plugin", "e2e", "--wait"],
)
cluster_node.exec(
["./sonobuoy", "retrieve", "-f", "sonobuoy_e2e.tar.gz"],
)
cluster_node.exec(
["tar", "-xf", "sonobuoy_e2e.tar.gz", "--one-top-level"],
)
resp = cluster_node.exec(
["./sonobuoy", "results", "sonobuoy_e2e.tar.gz"],
capture_output=True,
)

cluster_node.pull_file("/root/sonobuoy_e2e.tar.gz", "sonobuoy_e2e.tar.gz")

output = resp.stdout.decode()
LOG.info(output)
failed_tests = int(re.search("Failed: (\\d+)", output).group(1))
assert failed_tests == 0, f"{failed_tests} tests failed"


def cluster_setup(instances: List[harness.Instance]) -> harness.Instance:
cluster_node = instances[0]
joining_node = instances[1]

join_token = util.get_join_token(cluster_node, joining_node)
util.join_cluster(joining_node, join_token)

util.wait_until_k8s_ready(cluster_node, instances)

nodes = util.ready_nodes(cluster_node)
assert len(nodes) == 2, "node should have joined cluster"
assert "control-plane" in util.get_local_node_status(cluster_node)
assert "control-plane" in util.get_local_node_status(joining_node)

config = cluster_node.exec(["k8s", "config"], capture_output=True)
cluster_node.exec(["dd", "of=/root/.kube/config"], input=config.stdout)
maci3jka marked this conversation as resolved.
Show resolved Hide resolved

return cluster_node


def install_sonobuoy(instance: harness.Instance):
instance.exec(
["curl", "-L", config.sonobuoy_tar_gz(instance.arch), "-o", "sonobuoy.tar.gz"]
)
instance.exec(["tar", "xvzf", "sonobuoy.tar.gz"])
instance.exec(["./sonobuoy", "version"])
9 changes: 9 additions & 0 deletions tests/integration/tests/test_util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,12 @@
STRICT_INTERFACE_CHANNELS = (
os.environ.get("TEST_STRICT_INTERFACE_CHANNELS", "").strip().split()
)

# SONOBUOY_VERSION is version of sonobuoy to use
SONOBUOY_VERSION = os.getenv("TEST_SONOBUOY_VERSION") or "v0.57.2"


# sonobuoy_tar_gz is a full path of sonobuoy to download
def sonobuoy_tar_gz(architecture: str) -> str:
os.getenv("TEST_SONOBUOY_VERSION") or "v0.57.2"
return f"https://github.com/vmware-tanzu/sonobuoy/releases/download/{SONOBUOY_VERSION}/sonobuoy_{SONOBUOY_VERSION[1: ]}_linux_{architecture}.tar.gz" # noqa
Loading