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

Run all tests for backports or when there are test changes #882

Closed
wants to merge 5 commits into from
Closed
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
12 changes: 11 additions & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,17 @@ jobs:
TEST_VERSION_UPGRADE_MIN_RELEASE: "1.31"
TEST_MIRROR_LIST: '[{"name": "ghcr.io", "port": 5000, "remote": "https://ghcr.io", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}"}, {"name": "docker.io", "port": 5001, "remote": "https://registry-1.docker.io", "username": "", "password": ""}, {"name": "rocks.canonical.com", "port": 5002, "remote": "https://rocks.canonical.com/cdk"}]'
run: |
cd tests/integration && sg lxd -c 'tox -e integration -- --tags pull_request'
tags="pull_request"
# Run all tests if there are test changes. In case of a PR, we'll
# get a merge commit that includes all changes.
if git diff HEAD HEAD~1 --name-only | grep "tests/"; then
tags="weekly"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be up_to_weekly otherwise only the weekly tags are executed. Same below.
See

combine_tags("up_to_nightly", PULL_REQUEST, NIGHTLY)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks!

fi
# Run all tests on backports.
if echo ${{ github.base_ref }} | grep "release-"; then
tags="weekly"
fi
cd tests/integration && sg lxd -c 'tox -e integration -- --tags $tags'
- name: Prepare inspection reports
if: failure()
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nightly-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
release: ["latest/edge"]
fail-fast: false # TODO: remove once arm64 works

runs-on: ${{ matrix.arch == 'arm64' && ["self-hosted", "Linux", "ARM64", "jammy", "large"] || ["self-hosted", "Linux", "AMD64", "jammy", "large"] }}
runs-on: ${{ matrix.arch == 'arm64' && 'self-hosted-linux-arm64-jammy-large' || 'self-hosted-linux-amd64-jammy-large' }}

steps:
- name: Checking out repo
Expand All @@ -30,6 +30,8 @@ jobs:
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
- name: Create build directory
run: mkdir -p build
- name: Install ${{ matrix.release }} k8s snap
Expand Down
6 changes: 3 additions & 3 deletions src/k8s/pkg/k8sd/api/cluster_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ func (e *Endpoints) postClusterJoin(s state.State, r *http.Request) response.Res

joinConfig := struct {
// We only care about this field from the entire join config.
containerdBaseDir string `yaml:"containerd-base-dir,omitempty"`
ContainerdBaseDir string `yaml:"containerd-base-dir,omitempty"`
}{}

if err := yaml.Unmarshal([]byte(req.Config), &joinConfig); err != nil {
return response.BadRequest(fmt.Errorf("failed to parse request config: %w", err))
}

if joinConfig.containerdBaseDir != "" {
if joinConfig.ContainerdBaseDir != "" {
// append k8s-containerd to the given base dir, so we don't flood it with our own folders.
e.provider.Snap().SetContainerdBaseDir(filepath.Join(joinConfig.containerdBaseDir, "k8s-containerd"))
e.provider.Snap().SetContainerdBaseDir(filepath.Join(joinConfig.ContainerdBaseDir, "k8s-containerd"))
}

config := map[string]string{}
Expand Down
19 changes: 16 additions & 3 deletions tests/integration/tests/test_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,28 @@ def test_node_cleanup_new_containerd_path(instances: List[harness.Instance]):

boostrap_config = yaml.safe_load(containerd_path_bootstrap_config)
new_containerd_paths = [
os.path.join(boostrap_config["containerd-base-dir"], "k8s-containerd", p)
os.path.join(
boostrap_config["containerd-base-dir"], "k8s-containerd", p.lstrip("/")
)
for p in CONTAINERD_PATHS
]

# We expect containerd to use our custom paths instead of the default ones.
# However, the test fixture places registry configuration in /etc/containerd
# and /run/containerd gets created but isn't actually used (requires further
# investigation).
exp_missing_paths = [
"/etc/containerd/config.toml",
"/run/containerd/containerd.sock",
"/var/lib/containerd",
]

for instance in instances:
# Check that the containerd-related folders are not in the default locations.
process = instance.exec(
["ls", *CONTAINERD_PATHS], capture_output=True, text=True, check=False
["ls", *exp_missing_paths], capture_output=True, text=True, check=False
)
for path in CONTAINERD_PATHS:
for path in exp_missing_paths:
assert (
f"cannot access '{path}': No such file or directory" in process.stderr
)
Expand Down
Loading