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

permissions:
contents: read
Expand Down Expand Up @@ -42,6 +43,7 @@ jobs:
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ${{ matrix.os }}
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_CNCF_E2E: true
# 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"
Expand All @@ -64,3 +66,15 @@ jobs:
if: ${{ failure() && github.event_name == 'pull_request' }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
- name: Extract CNCF conformance report
if: failure()
working-directory: tests/integration
run: |
tar -xf sonobuoy_e2e.tar.gz --one-top-level
echo "os_dash=${{ matrix.os }}" | sed 's/:/-/g' >> $GITHUB_ENV
- name: Upload CNCF conformance report artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: report_sonobuoy_e2e_${{ env.os_dash }}_${{ matrix.arch }}
path: tests/integration/sonobuoy_e2e
67 changes: 67 additions & 0 deletions tests/integration/tests/test_cncf_conformace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Copyright 2024 Canonical, Ltd.
#
import logging
import os
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,
)
LOG.info(resp.stdout.decode())
cluster_node.pull_file("/root/sonobuoy_e2e.tar.gz", "sonobuoy_e2e.tar.gz")
assert "Failed: 0" in resp.stdout.decode()
maci3jka marked this conversation as resolved.
Show resolved Hide resolved


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, "-o", "sonobuoy.tar.gz"])
instance.exec(["tar", "xvzf", "sonobuoy.tar.gz"])
instance.exec(["./sonobuoy", "version"])
16 changes: 16 additions & 0 deletions tests/integration/tests/test_util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright 2024 Canonical, Ltd.
#
import os
import platform
from pathlib import Path

DIR = Path(__file__).absolute().parent
Expand Down Expand Up @@ -124,3 +125,18 @@
STRICT_INTERFACE_CHANNELS = (
os.environ.get("TEST_STRICT_INTERFACE_CHANNELS", "").strip().split()
)

# ARCH_MAP is a map changing python architecture naming to common one
ARCH_MAP = {"aarch64": "arm64", "x86_64": "amd64"}
maci3jka marked this conversation as resolved.
Show resolved Hide resolved

# ARCHITECTURE is an architecture of current machine
ARCHITECTURE = os.getenv("TEST_ARCHITECTURE") or ARCH_MAP.get(platform.machine())

# 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
SONOBUOY_TAR_GZ = (
os.getenv("TEST_SONOBUOY_TAR_GZ")
or f"https://github.com/vmware-tanzu/sonobuoy/releases/download/{SONOBUOY_VERSION}/sonobuoy_{SONOBUOY_VERSION[1: ]}_linux_{ARCHITECTURE}.tar.gz" # noqa
)
maci3jka marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion tests/integration/tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
skipsdist = True
skip_missing_interpreters = True
env_list = format, lint, integration
env_list = format, lint, integration, e2e
maci3jka marked this conversation as resolved.
Show resolved Hide resolved
maci3jka marked this conversation as resolved.
Show resolved Hide resolved

[testenv]
set_env =
Expand Down
Loading