From 6e5bccdcb23796288b9ac3324be72fc84a4c3c23 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Sun, 15 Nov 2026 14:05:01 -0800 Subject: [PATCH 1/8] test(conformance): run the conformance suite against a gateway that pushes configuration Add the ubuntu-docker-rootful-config-push tmachine environment. Its setup playbook, config-delivery.yaml, writes config_delivery_mode to the gateway overrides that the deb, rpm and binaries installers apply, and publishes the mode as OPENSHELL_TEST_CONFIG_DELIVERY_MODE. A push gateway lets a supervisor without push support keep polling, so the conformance suite passes in either mode. The new config-push feature suite fails unless the published mode is push and a new sandbox's supervisor reports a pushed-configuration session. E2E Suites runs the conformance family and the config-push suite in the new environment with the deb installer. mise run e2e:testkit:push runs both against a local Docker gateway in push mode. Signed-off-by: Piotr Mlocek --- .github/workflows/e2e-suites.yml | 2 + TESTING.md | 32 ++++++++ tasks/test.toml | 6 ++ tests/suites/features/Cargo.lock | 7 ++ tests/suites/features/Cargo.toml | 2 +- tests/suites/features/config-push/Cargo.toml | 15 ++++ .../features/config-push/tests/config_push.rs | 76 +++++++++++++++++++ .../ansible/playbooks/config-delivery.yaml | 65 ++++++++++++++++ tests/tmachine/config.nix | 17 +++++ 9 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 tests/suites/features/config-push/Cargo.toml create mode 100644 tests/suites/features/config-push/tests/config_push.rs create mode 100644 tests/tmachine/ansible/playbooks/config-delivery.yaml diff --git a/.github/workflows/e2e-suites.yml b/.github/workflows/e2e-suites.yml index 7c995a198b..1d59aab633 100644 --- a/.github/workflows/e2e-suites.yml +++ b/.github/workflows/e2e-suites.yml @@ -80,7 +80,9 @@ jobs: {"environment":"fedora-podman-rootless","installer":"rpm","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"ubuntu-k3s","installer":"k3s","family":"conformance","package":"conformance","gateway":"tmachine","runner":"ubuntu-24.04"}, {"environment":"ubuntu-k3s","installer":"k3s-ha","family":"conformance","package":"conformance","gateway":"tmachine","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-docker-rootful-config-push","installer":"deb","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"ubuntu-docker-rootful-keycloak","installer":"deb","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-docker-rootful-config-push","installer":"deb","family":"features","package":"config-push","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"ubuntu-docker-rootful","installer":"deb","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootful","installer":"rpm","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootless","installer":"rpm","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"}, diff --git a/TESTING.md b/TESTING.md index 2250118e6e..cf2374c04d 100644 --- a/TESTING.md +++ b/TESTING.md @@ -601,6 +601,38 @@ leaving the file unchanged, when it isn't valid TOML. It can't remove a key. Settings that the packaged service reads from `gateway.env` instead of the TOML are not covered. +#### Conformance with gateway config push + +The `ubuntu-docker-rootful-config-push` environment runs the gateway with +`config_delivery_mode = "push"`, so supervisors receive configuration over +their session instead of polling for it. Its setup playbook, +`tests/tmachine/ansible/playbooks/config-delivery.yaml`, writes the mode to the +gateway overrides and publishes it as `OPENSHELL_TEST_CONFIG_DELIVERY_MODE`. +The playbook takes `push` or `poll` as `gateway_config_delivery_mode`, so an +environment for the other mode is one more entry in `config.nix`. k3s +installers ignore gateway overrides, so it doesn't apply to them. + +A push gateway lets a supervisor without push support keep polling, so the +conformance suite passes either way. The `config-push` feature suite +(`tests/suites/features/config-push`) fails unless the published mode is +`push` and a new sandbox's supervisor reports a pushed-configuration session. +CI runs both in the environment: + +```shell +nix run .#openshell-test-runner -- run \ + --environment ubuntu-docker-rootful-config-push --installer deb \ + --family conformance --package conformance +nix run .#openshell-test-runner -- run \ + --environment ubuntu-docker-rootful-config-push --installer deb \ + --family features --package config-push +``` + +Without KVM, run both against a local Docker gateway in push mode: + +```shell +mise run e2e:testkit:push +``` + The `oci-image` feature suite (`tests/suites/features/oci-image`) checks OCI image identity and working-directory behavior shared by the Docker and Podman drivers against installed deb packages on Ubuntu and rpm packages on Fedora. diff --git a/tasks/test.toml b/tasks/test.toml index 89eb4709b7..857b975443 100644 --- a/tasks/test.toml +++ b/tasks/test.toml @@ -191,6 +191,12 @@ description = "Run the testkit suites in tests/suites/conformance against a Dock depends = ["e2e:workload:build"] run = "e2e/with-docker-gateway.sh cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast" +["e2e:testkit:push"] +description = "Run the conformance suite and the config-push feature suite against a Docker gateway that pushes configuration" +depends = ["e2e:workload:build"] +env = { OPENSHELL_CONFIG_DELIVERY_MODE = "push", OPENSHELL_TEST_CONFIG_DELIVERY_MODE = "push" } +run = "e2e/with-docker-gateway.sh bash -c 'cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast && cargo nextest run --locked --manifest-path tests/suites/features/Cargo.toml -p config-push --test-threads 1'" + ["e2e:rust:push"] description = "Run conformance and policy e2e tests against a Docker gateway that pushes configuration" env = { OPENSHELL_CONFIG_DELIVERY_MODE = "push", OPENSHELL_E2E_DOCKER_FEATURES = "e2e-config-push", OPENSHELL_E2E_DOCKER_TEST = "config_push live_policy_update policy_activation" } diff --git a/tests/suites/features/Cargo.lock b/tests/suites/features/Cargo.lock index bcc428d57d..2a2cda74ab 100644 --- a/tests/suites/features/Cargo.lock +++ b/tests/suites/features/Cargo.lock @@ -512,6 +512,13 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "config-push" +version = "0.0.0" +dependencies = [ + "openshell-testkit", +] + [[package]] name = "container-engine-support" version = "0.0.0" diff --git a/tests/suites/features/Cargo.toml b/tests/suites/features/Cargo.toml index af907b4b15..a16045d1a3 100644 --- a/tests/suites/features/Cargo.toml +++ b/tests/suites/features/Cargo.toml @@ -3,4 +3,4 @@ [workspace] resolver = "2" -members = ["host-gateway", "keycloak-provider-refresh", "kubernetes-updates", "oci-image"] +members = ["config-push", "host-gateway", "keycloak-provider-refresh", "kubernetes-updates", "oci-image"] diff --git a/tests/suites/features/config-push/Cargo.toml b/tests/suites/features/config-push/Cargo.toml new file mode 100644 index 0000000000..94ed53018e --- /dev/null +++ b/tests/suites/features/config-push/Cargo.toml @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "config-push" +description = "Features suite: the gateway pushes configuration over the supervisor session" +version = "0.0.0" +edition = "2024" +rust-version = "1.94" +license = "Apache-2.0" +repository = "https://github.com/NVIDIA/OpenShell" +publish = false + +[dependencies] +openshell-testkit = { path = "../../../testkit/testkit" } diff --git a/tests/suites/features/config-push/tests/config_push.rs b/tests/suites/features/config-push/tests/config_push.rs new file mode 100644 index 0000000000..a9df267a5d --- /dev/null +++ b/tests/suites/features/config-push/tests/config_push.rs @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! The gateway pushes configuration over the supervisor session. +//! +//! An environment that configures the gateway with +//! `config_delivery_mode = "push"` publishes +//! `OPENSHELL_TEST_CONFIG_DELIVERY_MODE=push` (the tmachine +//! `ubuntu-docker-rootful-config-push` environment does). A gateway in push +//! mode still lets a supervisor without push support poll, so nothing else +//! fails when push is silently off. This test fails then: the supervisor of +//! a new sandbox must report that its session receives pushed configuration. + +use std::time::Duration; + +use testkit::{Context, Error, Poll, Result}; + +/// The variable the environment publishes with the gateway's delivery mode. +const MODE_ENV: &str = "OPENSHELL_TEST_CONFIG_DELIVERY_MODE"; + +/// What the supervisor logs once the gateway accepts its session with config +/// push enabled +/// (crates/openshell-supervisor-process/src/supervisor_session.rs). +const PUSHED_SESSION: &str = "gateway pushes configuration over the session"; + +/// How long the supervisor's log may take to reach the gateway after the +/// sandbox is Ready. +const LOG_TIMEOUT: Duration = Duration::from_secs(60); +const LOG_INTERVAL: Duration = Duration::from_secs(2); + +/// A new sandbox's supervisor session receives configuration by push. +#[testkit::test] +async fn supervisor_session_receives_pushed_configuration(cx: &mut Context) -> Result { + let mode = std::env::var(MODE_ENV).map_err(|_| { + Error::msg(format!( + "{MODE_ENV} is not set; run this suite in an environment whose gateway pushes \ + configuration, such as ubuntu-docker-rootful-config-push" + )) + })?; + testkit::ensure!( + mode == "push", + "{MODE_ENV} is {mode:?}; this suite needs a gateway with config_delivery_mode = \"push\"" + ); + + let sandbox = cx + .sandbox("push") + .command(["sleep", "infinity"]) + .create() + .await?; + sandbox.wait_ready().await?; + + let name = sandbox.name().to_string(); + testkit::poll_until( + "the supervisor to report a pushed-configuration session", + LOG_TIMEOUT, + LOG_INTERVAL, + async || { + let logs = cx + .cli(["logs", &name, "-n", "500", "--source", "sandbox"]) + .await? + .success()?; + Ok(if logs.stdout.contains(PUSHED_SESSION) { + Poll::Ready(()) + } else { + Poll::Pending(format!( + "no {PUSHED_SESSION:?} in the sandbox log; is the gateway polling?\n{}", + logs.stdout + )) + }) + }, + ) + .await?; + + sandbox.delete().await?; + cx.expect_absent(&sandbox).await +} diff --git a/tests/tmachine/ansible/playbooks/config-delivery.yaml b/tests/tmachine/ansible/playbooks/config-delivery.yaml new file mode 100644 index 0000000000..39af52be91 --- /dev/null +++ b/tests/tmachine/ansible/playbooks/config-delivery.yaml @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Set how the gateway delivers configuration to supervisors, and publish it. +# +# `gateway_config_delivery_mode` is push or poll. The playbook writes +# `[openshell.gateway] config_delivery_mode` to +# /etc/openshell-test/gateway-overrides.toml, which the `binaries`, `deb` and +# `rpm` installers apply to the gateway's configuration (k3s installers ignore +# it). It publishes the mode as OPENSHELL_TEST_CONFIG_DELIVERY_MODE, which the +# config-push feature suite (tests/suites/features/config-push) checks against +# the supervisor's own report. +--- +- name: Gateway configuration delivery for tests + hosts: all + gather_facts: false + vars: + config_delivery_overrides: /etc/openshell-test/gateway-overrides.toml + tasks: + - name: Wait for SSH + ansible.builtin.wait_for_connection: + + - name: Require a known configuration delivery mode + ansible.builtin.assert: + that: + - gateway_config_delivery_mode is defined + - gateway_config_delivery_mode in ['push', 'poll'] + fail_msg: >- + gateway_config_delivery_mode must be push or poll, not + {{ gateway_config_delivery_mode | default('unset') }} + + - name: Create the test configuration directory + become: true + ansible.builtin.file: + path: "{{ config_delivery_overrides | dirname }}" + state: directory + owner: root + group: root + mode: "0755" + + # A managed block, so other playbooks can add their own tables to the + # file. `[openshell] version` is what the gateway's own configuration + # already declares; a drop-in configuration must state it too. + - name: Write the configuration delivery mode + become: true + ansible.builtin.blockinfile: + path: "{{ config_delivery_overrides }}" + create: true + owner: root + group: root + mode: "0644" + marker: "# {mark} config-delivery.yaml" + block: | + [openshell] + version = 2 + + [openshell.gateway] + config_delivery_mode = "{{ gateway_config_delivery_mode }}" + + - name: Publish the configuration delivery mode + ansible.builtin.include_tasks: test-env.yaml + vars: + test_env_name: config-delivery + test_env_vars: + OPENSHELL_TEST_CONFIG_DELIVERY_MODE: "{{ gateway_config_delivery_mode }}" diff --git a/tests/tmachine/config.nix b/tests/tmachine/config.nix index 8a8a798176..bc2f1e74c8 100644 --- a/tests/tmachine/config.nix +++ b/tests/tmachine/config.nix @@ -135,6 +135,23 @@ let }; }; } + # ubuntu-docker-rootful with a gateway that pushes configuration to + # supervisors (`config_delivery_mode = "push"`), for the conformance + # family and the config-push feature suite. + { + name = "ubuntu-docker-rootful-config-push"; + machine = "ubuntu"; + setup = { + use_galaxy = true; + playbooks = [ + "ansible/playbooks/nextest.yaml" + "ansible/playbooks/test-tools.yaml" + "ansible/playbooks/docker.yaml" + "ansible/playbooks/config-delivery.yaml" + ]; + inputs.gateway_config_delivery_mode = "push"; + }; + } { name = "ubuntu-k3s"; machine = "ubuntu"; From 3ab4245bac5161d7c219a472bbb9eee1ffffa625 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Sun, 15 Nov 2026 14:21:36 -0800 Subject: [PATCH 2/8] test(conformance): rely on the supervisor's push report alone The supervisor logs a pushed-configuration session only when the gateway accepted it with push enabled, so the config-push suite no longer also requires an OPENSHELL_TEST_CONFIG_DELIVERY_MODE variable. The environment's playbook, now config-push.yaml, sets push without a mode input, since polling is going away, and no longer writes an [openshell] table that a second overrides writer could duplicate. The test retries a failed `openshell logs` call until its timeout. e2e:testkit:push runs the push check before the conformance suite, so a conformance failure can't hide whether push was on. The TESTING.md section moves next to the tmachine runner docs instead of capturing the feature suite paragraphs that follow the gateway overrides section. Signed-off-by: Piotr Mlocek --- TESTING.md | 62 +++++++++--------- tasks/test.toml | 6 +- .../features/config-push/tests/config_push.rs | 47 ++++++-------- .../ansible/playbooks/config-delivery.yaml | 65 ------------------- .../ansible/playbooks/config-push.yaml | 44 +++++++++++++ tests/tmachine/config.nix | 3 +- 6 files changed, 97 insertions(+), 130 deletions(-) delete mode 100644 tests/tmachine/ansible/playbooks/config-delivery.yaml create mode 100644 tests/tmachine/ansible/playbooks/config-push.yaml diff --git a/TESTING.md b/TESTING.md index cf2374c04d..20df4bc7b6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -276,6 +276,36 @@ per family when the `test:e2e` label is set, and a failure fails the Core E2E result. Release Dev and Release Qualification run the conformance and feature families. To run a suite in another environment on CI, add a row. +### Conformance with gateway config push + +The `ubuntu-docker-rootful-config-push` environment runs the gateway with +`config_delivery_mode = "push"`, so supervisors receive configuration over +their session instead of polling for it. Its setup playbook, +`tests/tmachine/ansible/playbooks/config-push.yaml`, adds the setting to the +environment's gateway overrides (see +[Gateway overrides in an environment](#gateway-overrides-in-an-environment)), +which k3s installers ignore. + +A push gateway lets a supervisor without push support keep polling, so the +conformance suite passes either way. The `config-push` feature suite +(`tests/suites/features/config-push`) fails unless a new sandbox's supervisor +reports a pushed-configuration session. CI runs both in the environment: + +```shell +nix run .#openshell-test-runner -- run \ + --environment ubuntu-docker-rootful-config-push --installer deb \ + --family conformance --package conformance +nix run .#openshell-test-runner -- run \ + --environment ubuntu-docker-rootful-config-push --installer deb \ + --family features --package config-push +``` + +Without KVM, run both against a local Docker gateway in push mode: + +```shell +mise run e2e:testkit:push +``` + ### Adding a feature suite Feature suites live in the `tests/suites/features` workspace, one crate per @@ -601,38 +631,6 @@ leaving the file unchanged, when it isn't valid TOML. It can't remove a key. Settings that the packaged service reads from `gateway.env` instead of the TOML are not covered. -#### Conformance with gateway config push - -The `ubuntu-docker-rootful-config-push` environment runs the gateway with -`config_delivery_mode = "push"`, so supervisors receive configuration over -their session instead of polling for it. Its setup playbook, -`tests/tmachine/ansible/playbooks/config-delivery.yaml`, writes the mode to the -gateway overrides and publishes it as `OPENSHELL_TEST_CONFIG_DELIVERY_MODE`. -The playbook takes `push` or `poll` as `gateway_config_delivery_mode`, so an -environment for the other mode is one more entry in `config.nix`. k3s -installers ignore gateway overrides, so it doesn't apply to them. - -A push gateway lets a supervisor without push support keep polling, so the -conformance suite passes either way. The `config-push` feature suite -(`tests/suites/features/config-push`) fails unless the published mode is -`push` and a new sandbox's supervisor reports a pushed-configuration session. -CI runs both in the environment: - -```shell -nix run .#openshell-test-runner -- run \ - --environment ubuntu-docker-rootful-config-push --installer deb \ - --family conformance --package conformance -nix run .#openshell-test-runner -- run \ - --environment ubuntu-docker-rootful-config-push --installer deb \ - --family features --package config-push -``` - -Without KVM, run both against a local Docker gateway in push mode: - -```shell -mise run e2e:testkit:push -``` - The `oci-image` feature suite (`tests/suites/features/oci-image`) checks OCI image identity and working-directory behavior shared by the Docker and Podman drivers against installed deb packages on Ubuntu and rpm packages on Fedora. diff --git a/tasks/test.toml b/tasks/test.toml index 857b975443..f0c607a34b 100644 --- a/tasks/test.toml +++ b/tasks/test.toml @@ -192,10 +192,10 @@ depends = ["e2e:workload:build"] run = "e2e/with-docker-gateway.sh cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast" ["e2e:testkit:push"] -description = "Run the conformance suite and the config-push feature suite against a Docker gateway that pushes configuration" +description = "Run the config-push feature suite, then the conformance suite, against a Docker gateway that pushes configuration" depends = ["e2e:workload:build"] -env = { OPENSHELL_CONFIG_DELIVERY_MODE = "push", OPENSHELL_TEST_CONFIG_DELIVERY_MODE = "push" } -run = "e2e/with-docker-gateway.sh bash -c 'cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast && cargo nextest run --locked --manifest-path tests/suites/features/Cargo.toml -p config-push --test-threads 1'" +env = { OPENSHELL_CONFIG_DELIVERY_MODE = "push" } +run = "e2e/with-docker-gateway.sh bash -c 'cargo nextest run --locked --manifest-path tests/suites/features/Cargo.toml -p config-push --test-threads 1 && cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast'" ["e2e:rust:push"] description = "Run conformance and policy e2e tests against a Docker gateway that pushes configuration" diff --git a/tests/suites/features/config-push/tests/config_push.rs b/tests/suites/features/config-push/tests/config_push.rs index a9df267a5d..f3215e3454 100644 --- a/tests/suites/features/config-push/tests/config_push.rs +++ b/tests/suites/features/config-push/tests/config_push.rs @@ -3,23 +3,19 @@ //! The gateway pushes configuration over the supervisor session. //! -//! An environment that configures the gateway with -//! `config_delivery_mode = "push"` publishes -//! `OPENSHELL_TEST_CONFIG_DELIVERY_MODE=push` (the tmachine -//! `ubuntu-docker-rootful-config-push` environment does). A gateway in push -//! mode still lets a supervisor without push support poll, so nothing else -//! fails when push is silently off. This test fails then: the supervisor of -//! a new sandbox must report that its session receives pushed configuration. +//! Run it against a gateway with `config_delivery_mode = "push"`, such as the +//! one in the tmachine `ubuntu-docker-rootful-config-push` environment. Such +//! a gateway still lets a supervisor without push support poll, so nothing +//! else fails when push is silently off. This test fails then: the supervisor +//! of a new sandbox must report that its session receives pushed +//! configuration. use std::time::Duration; -use testkit::{Context, Error, Poll, Result}; +use testkit::{Context, Poll, Result}; -/// The variable the environment publishes with the gateway's delivery mode. -const MODE_ENV: &str = "OPENSHELL_TEST_CONFIG_DELIVERY_MODE"; - -/// What the supervisor logs once the gateway accepts its session with config -/// push enabled +/// What the supervisor logs, only when the gateway accepts its session with +/// config push enabled /// (crates/openshell-supervisor-process/src/supervisor_session.rs). const PUSHED_SESSION: &str = "gateway pushes configuration over the session"; @@ -31,17 +27,6 @@ const LOG_INTERVAL: Duration = Duration::from_secs(2); /// A new sandbox's supervisor session receives configuration by push. #[testkit::test] async fn supervisor_session_receives_pushed_configuration(cx: &mut Context) -> Result { - let mode = std::env::var(MODE_ENV).map_err(|_| { - Error::msg(format!( - "{MODE_ENV} is not set; run this suite in an environment whose gateway pushes \ - configuration, such as ubuntu-docker-rootful-config-push" - )) - })?; - testkit::ensure!( - mode == "push", - "{MODE_ENV} is {mode:?}; this suite needs a gateway with config_delivery_mode = \"push\"" - ); - let sandbox = cx .sandbox("push") .command(["sleep", "infinity"]) @@ -57,13 +42,19 @@ async fn supervisor_session_receives_pushed_configuration(cx: &mut Context) -> R async || { let logs = cx .cli(["logs", &name, "-n", "500", "--source", "sandbox"]) - .await? - .success()?; - Ok(if logs.stdout.contains(PUSHED_SESSION) { + .await?; + // A failed read is retried; the timeout reports the last one. + Ok(if logs.exit_code != 0 { + Poll::Pending(format!( + "`openshell logs` exited with {}: {}", + logs.exit_code, logs.stderr + )) + } else if logs.stdout.contains(PUSHED_SESSION) { Poll::Ready(()) } else { Poll::Pending(format!( - "no {PUSHED_SESSION:?} in the sandbox log; is the gateway polling?\n{}", + "no {PUSHED_SESSION:?} in the sandbox log; is the gateway configured with \ + config_delivery_mode = \"push\"?\n{}", logs.stdout )) }) diff --git a/tests/tmachine/ansible/playbooks/config-delivery.yaml b/tests/tmachine/ansible/playbooks/config-delivery.yaml deleted file mode 100644 index 39af52be91..0000000000 --- a/tests/tmachine/ansible/playbooks/config-delivery.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -# Set how the gateway delivers configuration to supervisors, and publish it. -# -# `gateway_config_delivery_mode` is push or poll. The playbook writes -# `[openshell.gateway] config_delivery_mode` to -# /etc/openshell-test/gateway-overrides.toml, which the `binaries`, `deb` and -# `rpm` installers apply to the gateway's configuration (k3s installers ignore -# it). It publishes the mode as OPENSHELL_TEST_CONFIG_DELIVERY_MODE, which the -# config-push feature suite (tests/suites/features/config-push) checks against -# the supervisor's own report. ---- -- name: Gateway configuration delivery for tests - hosts: all - gather_facts: false - vars: - config_delivery_overrides: /etc/openshell-test/gateway-overrides.toml - tasks: - - name: Wait for SSH - ansible.builtin.wait_for_connection: - - - name: Require a known configuration delivery mode - ansible.builtin.assert: - that: - - gateway_config_delivery_mode is defined - - gateway_config_delivery_mode in ['push', 'poll'] - fail_msg: >- - gateway_config_delivery_mode must be push or poll, not - {{ gateway_config_delivery_mode | default('unset') }} - - - name: Create the test configuration directory - become: true - ansible.builtin.file: - path: "{{ config_delivery_overrides | dirname }}" - state: directory - owner: root - group: root - mode: "0755" - - # A managed block, so other playbooks can add their own tables to the - # file. `[openshell] version` is what the gateway's own configuration - # already declares; a drop-in configuration must state it too. - - name: Write the configuration delivery mode - become: true - ansible.builtin.blockinfile: - path: "{{ config_delivery_overrides }}" - create: true - owner: root - group: root - mode: "0644" - marker: "# {mark} config-delivery.yaml" - block: | - [openshell] - version = 2 - - [openshell.gateway] - config_delivery_mode = "{{ gateway_config_delivery_mode }}" - - - name: Publish the configuration delivery mode - ansible.builtin.include_tasks: test-env.yaml - vars: - test_env_name: config-delivery - test_env_vars: - OPENSHELL_TEST_CONFIG_DELIVERY_MODE: "{{ gateway_config_delivery_mode }}" diff --git a/tests/tmachine/ansible/playbooks/config-push.yaml b/tests/tmachine/ansible/playbooks/config-push.yaml new file mode 100644 index 0000000000..f512c79747 --- /dev/null +++ b/tests/tmachine/ansible/playbooks/config-push.yaml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Make the gateway push configuration to supervisors. +# +# Writes `[openshell.gateway] config_delivery_mode = "push"` to +# /etc/openshell-test/gateway-overrides.toml, which the `binaries`, `deb` and +# `rpm` installers apply to the gateway's configuration (k3s installers ignore +# it). The config-push feature suite (tests/suites/features/config-push) fails +# unless a supervisor reports a pushed-configuration session. +--- +- name: Gateway configuration push for tests + hosts: all + gather_facts: false + vars: + config_push_overrides: /etc/openshell-test/gateway-overrides.toml + tasks: + - name: Wait for SSH + ansible.builtin.wait_for_connection: + + - name: Create the test configuration directory + become: true + ansible.builtin.file: + path: "{{ config_push_overrides | dirname }}" + state: directory + owner: root + group: root + mode: "0755" + + # A managed block keeps tables that earlier playbooks wrote. A playbook + # that replaces the whole file, such as drivers/podman/userns.yaml, must + # run before this one. + - name: Write the configuration delivery mode + become: true + ansible.builtin.blockinfile: + path: "{{ config_push_overrides }}" + create: true + owner: root + group: root + mode: "0644" + marker: "# {mark} config-push.yaml" + block: | + [openshell.gateway] + config_delivery_mode = "push" diff --git a/tests/tmachine/config.nix b/tests/tmachine/config.nix index bc2f1e74c8..ca4456d9bb 100644 --- a/tests/tmachine/config.nix +++ b/tests/tmachine/config.nix @@ -147,9 +147,8 @@ let "ansible/playbooks/nextest.yaml" "ansible/playbooks/test-tools.yaml" "ansible/playbooks/docker.yaml" - "ansible/playbooks/config-delivery.yaml" + "ansible/playbooks/config-push.yaml" ]; - inputs.gateway_config_delivery_mode = "push"; }; } { From 6e54715f4c7df4cfb062a51338b2773f36184210 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 16 Nov 2026 13:59:47 -0800 Subject: [PATCH 3/8] test(config-push): use the sandbox handle's expect_absent Signed-off-by: Piotr Mlocek --- tests/suites/features/config-push/tests/config_push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/suites/features/config-push/tests/config_push.rs b/tests/suites/features/config-push/tests/config_push.rs index f3215e3454..a9e3c994d3 100644 --- a/tests/suites/features/config-push/tests/config_push.rs +++ b/tests/suites/features/config-push/tests/config_push.rs @@ -63,5 +63,5 @@ async fn supervisor_session_receives_pushed_configuration(cx: &mut Context) -> R .await?; sandbox.delete().await?; - cx.expect_absent(&sandbox).await + sandbox.expect_absent().await } From fee923cf1c0bd8f2c3848039effd76cf0e81a4b3 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 16 Nov 2026 14:00:22 -0800 Subject: [PATCH 4/8] docs(testing): shorten the config-push environment note Signed-off-by: Piotr Mlocek --- TESTING.md | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/TESTING.md b/TESTING.md index 09b646e492..e0f58cce97 100644 --- a/TESTING.md +++ b/TESTING.md @@ -275,35 +275,9 @@ per family when the `test:e2e` label is set, and a failure fails the Core E2E result. Release Dev and Release Qualification run the conformance and feature families. To run a suite in another environment on CI, add a row. -### Conformance with gateway config push - -The `ubuntu-docker-rootful-config-push` environment runs the gateway with -`config_delivery_mode = "push"`, so supervisors receive configuration over -their session instead of polling for it. Its setup playbook, -`tests/tmachine/ansible/playbooks/config-push.yaml`, adds the setting to the -environment's gateway overrides (see -[Gateway overrides in an environment](#gateway-overrides-in-an-environment)), -which k3s installers ignore. - -A push gateway lets a supervisor without push support keep polling, so the -conformance suite passes either way. The `config-push` feature suite -(`tests/suites/features/config-push`) fails unless a new sandbox's supervisor -reports a pushed-configuration session. CI runs both in the environment: - -```shell -nix run .#openshell-test-runner -- run \ - --environment ubuntu-docker-rootful-config-push --installer deb \ - --family conformance --package conformance -nix run .#openshell-test-runner -- run \ - --environment ubuntu-docker-rootful-config-push --installer deb \ - --family features --package config-push -``` - -Without KVM, run both against a local Docker gateway in push mode: - -```shell -mise run e2e:testkit:push -``` +CI also runs the conformance family in `ubuntu-docker-rootful-config-push`, +whose gateway pushes configuration to supervisors. The `config-push` feature +suite runs there too and fails if push is not in use. ### Adding a feature suite From 3d3e07e8498a79beaf5c662b57e2dcbf2f7bd249 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 16 Nov 2026 14:08:28 -0800 Subject: [PATCH 5/8] test(conformance): drop the config-push evidence suite A gateway built from this tree rejects unknown config fields and its supervisor always supports push, so the push conformance row already runs with push on unless the override file stops being merged. The separate suite cost a VM per E2E run for that one case. Signed-off-by: Piotr Mlocek --- .github/workflows/e2e-suites.yml | 1 - TESTING.md | 3 +- tasks/test.toml | 4 +- tests/suites/features/Cargo.lock | 7 -- tests/suites/features/Cargo.toml | 2 +- tests/suites/features/config-push/Cargo.toml | 15 ----- .../features/config-push/tests/config_push.rs | 67 ------------------- .../ansible/playbooks/config-push.yaml | 3 +- tests/tmachine/config.nix | 3 +- 9 files changed, 6 insertions(+), 99 deletions(-) delete mode 100644 tests/suites/features/config-push/Cargo.toml delete mode 100644 tests/suites/features/config-push/tests/config_push.rs diff --git a/.github/workflows/e2e-suites.yml b/.github/workflows/e2e-suites.yml index 1cdb283b15..2c44f47277 100644 --- a/.github/workflows/e2e-suites.yml +++ b/.github/workflows/e2e-suites.yml @@ -92,7 +92,6 @@ jobs: {"environment":"fedora-podman-rootful-cdi","installer":"rpm","family":"features","package":"cdi","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootless-cdi","installer":"rpm","family":"features","package":"cdi","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"ubuntu-docker-rootful-keycloak","installer":"deb","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"}, - {"environment":"ubuntu-docker-rootful-config-push","installer":"deb","family":"features","package":"config-push","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"ubuntu-docker-rootful","installer":"deb","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootful","installer":"rpm","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootless","installer":"rpm","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"}, diff --git a/TESTING.md b/TESTING.md index e0f58cce97..bbccdeb29c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -276,8 +276,7 @@ result. Release Dev and Release Qualification run the conformance and feature families. To run a suite in another environment on CI, add a row. CI also runs the conformance family in `ubuntu-docker-rootful-config-push`, -whose gateway pushes configuration to supervisors. The `config-push` feature -suite runs there too and fails if push is not in use. +whose gateway pushes configuration to supervisors. ### Adding a feature suite diff --git a/tasks/test.toml b/tasks/test.toml index 7142d522c0..57784c77a9 100644 --- a/tasks/test.toml +++ b/tasks/test.toml @@ -207,10 +207,10 @@ depends = ["e2e:workload:build"] run = "e2e/with-docker-gateway.sh cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast" ["e2e:testkit:push"] -description = "Run the config-push feature suite, then the conformance suite, against a Docker gateway that pushes configuration" +description = "Run the conformance suite against a Docker gateway that pushes configuration" depends = ["e2e:workload:build"] env = { OPENSHELL_CONFIG_DELIVERY_MODE = "push" } -run = "e2e/with-docker-gateway.sh bash -c 'cargo nextest run --locked --manifest-path tests/suites/features/Cargo.toml -p config-push --test-threads 1 && cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast'" +run = "e2e/with-docker-gateway.sh cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --test-threads 1 --no-fail-fast" ["e2e:rust:push"] description = "Run conformance and policy e2e tests against a Docker gateway that pushes configuration" diff --git a/tests/suites/features/Cargo.lock b/tests/suites/features/Cargo.lock index 79dba6f4a9..0d91b3a2a9 100644 --- a/tests/suites/features/Cargo.lock +++ b/tests/suites/features/Cargo.lock @@ -520,13 +520,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "config-push" -version = "0.0.0" -dependencies = [ - "openshell-testkit", -] - [[package]] name = "container-engine-support" version = "0.0.0" diff --git a/tests/suites/features/Cargo.toml b/tests/suites/features/Cargo.toml index 58a97283d5..a592b6f028 100644 --- a/tests/suites/features/Cargo.toml +++ b/tests/suites/features/Cargo.toml @@ -3,4 +3,4 @@ [workspace] resolver = "2" -members = ["cdi", "config-push", "host-gateway", "keycloak-provider-refresh", "kubernetes-updates", "oci-image"] +members = ["cdi", "host-gateway", "keycloak-provider-refresh", "kubernetes-updates", "oci-image"] diff --git a/tests/suites/features/config-push/Cargo.toml b/tests/suites/features/config-push/Cargo.toml deleted file mode 100644 index 94ed53018e..0000000000 --- a/tests/suites/features/config-push/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "config-push" -description = "Features suite: the gateway pushes configuration over the supervisor session" -version = "0.0.0" -edition = "2024" -rust-version = "1.94" -license = "Apache-2.0" -repository = "https://github.com/NVIDIA/OpenShell" -publish = false - -[dependencies] -openshell-testkit = { path = "../../../testkit/testkit" } diff --git a/tests/suites/features/config-push/tests/config_push.rs b/tests/suites/features/config-push/tests/config_push.rs deleted file mode 100644 index a9e3c994d3..0000000000 --- a/tests/suites/features/config-push/tests/config_push.rs +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -//! The gateway pushes configuration over the supervisor session. -//! -//! Run it against a gateway with `config_delivery_mode = "push"`, such as the -//! one in the tmachine `ubuntu-docker-rootful-config-push` environment. Such -//! a gateway still lets a supervisor without push support poll, so nothing -//! else fails when push is silently off. This test fails then: the supervisor -//! of a new sandbox must report that its session receives pushed -//! configuration. - -use std::time::Duration; - -use testkit::{Context, Poll, Result}; - -/// What the supervisor logs, only when the gateway accepts its session with -/// config push enabled -/// (crates/openshell-supervisor-process/src/supervisor_session.rs). -const PUSHED_SESSION: &str = "gateway pushes configuration over the session"; - -/// How long the supervisor's log may take to reach the gateway after the -/// sandbox is Ready. -const LOG_TIMEOUT: Duration = Duration::from_secs(60); -const LOG_INTERVAL: Duration = Duration::from_secs(2); - -/// A new sandbox's supervisor session receives configuration by push. -#[testkit::test] -async fn supervisor_session_receives_pushed_configuration(cx: &mut Context) -> Result { - let sandbox = cx - .sandbox("push") - .command(["sleep", "infinity"]) - .create() - .await?; - sandbox.wait_ready().await?; - - let name = sandbox.name().to_string(); - testkit::poll_until( - "the supervisor to report a pushed-configuration session", - LOG_TIMEOUT, - LOG_INTERVAL, - async || { - let logs = cx - .cli(["logs", &name, "-n", "500", "--source", "sandbox"]) - .await?; - // A failed read is retried; the timeout reports the last one. - Ok(if logs.exit_code != 0 { - Poll::Pending(format!( - "`openshell logs` exited with {}: {}", - logs.exit_code, logs.stderr - )) - } else if logs.stdout.contains(PUSHED_SESSION) { - Poll::Ready(()) - } else { - Poll::Pending(format!( - "no {PUSHED_SESSION:?} in the sandbox log; is the gateway configured with \ - config_delivery_mode = \"push\"?\n{}", - logs.stdout - )) - }) - }, - ) - .await?; - - sandbox.delete().await?; - sandbox.expect_absent().await -} diff --git a/tests/tmachine/ansible/playbooks/config-push.yaml b/tests/tmachine/ansible/playbooks/config-push.yaml index f512c79747..1c092981f5 100644 --- a/tests/tmachine/ansible/playbooks/config-push.yaml +++ b/tests/tmachine/ansible/playbooks/config-push.yaml @@ -6,8 +6,7 @@ # Writes `[openshell.gateway] config_delivery_mode = "push"` to # /etc/openshell-test/gateway-overrides.toml, which the `binaries`, `deb` and # `rpm` installers apply to the gateway's configuration (k3s installers ignore -# it). The config-push feature suite (tests/suites/features/config-push) fails -# unless a supervisor reports a pushed-configuration session. +# it). --- - name: Gateway configuration push for tests hosts: all diff --git a/tests/tmachine/config.nix b/tests/tmachine/config.nix index 8119dbb167..fb110fb5d6 100644 --- a/tests/tmachine/config.nix +++ b/tests/tmachine/config.nix @@ -113,8 +113,7 @@ let setup.playbooks = [ "ansible/playbooks/cdi.yaml" ]; }; # A gateway that pushes configuration to supervisors - # (`config_delivery_mode = "push"`), for the conformance family and the - # config-push suite. + # (`config_delivery_mode = "push"`), for the conformance family. config-push = { bases = dockerBases; setup.playbooks = [ "ansible/playbooks/config-push.yaml" ]; From 06e80a751dbb5aa639b4fe1ed64cd7cfe32e6b1f Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 16 Nov 2026 14:48:44 -0800 Subject: [PATCH 6/8] docs(testing): drop the config-push environment note Signed-off-by: Piotr Mlocek --- TESTING.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/TESTING.md b/TESTING.md index bbccdeb29c..084535630a 100644 --- a/TESTING.md +++ b/TESTING.md @@ -275,9 +275,6 @@ per family when the `test:e2e` label is set, and a failure fails the Core E2E result. Release Dev and Release Qualification run the conformance and feature families. To run a suite in another environment on CI, add a row. -CI also runs the conformance family in `ubuntu-docker-rootful-config-push`, -whose gateway pushes configuration to supervisors. - ### Adding a feature suite Feature suites live in the `tests/suites/features` workspace, one crate per From 4d0495a944fe35b800a952aaa50e8ff10123422e Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 16 Nov 2026 15:37:41 -0800 Subject: [PATCH 7/8] test(tmachine): name every writer that replaces the gateway overrides file Signed-off-by: Piotr Mlocek --- tests/tmachine/ansible/playbooks/config-push.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/tmachine/ansible/playbooks/config-push.yaml b/tests/tmachine/ansible/playbooks/config-push.yaml index 1c092981f5..1bb982e9dc 100644 --- a/tests/tmachine/ansible/playbooks/config-push.yaml +++ b/tests/tmachine/ansible/playbooks/config-push.yaml @@ -26,9 +26,12 @@ group: root mode: "0755" - # A managed block keeps tables that earlier playbooks wrote. A playbook - # that replaces the whole file, such as drivers/podman/userns.yaml, must - # run before this one. + # A managed block keeps tables that earlier playbooks wrote. Some writers + # replace the whole file: drivers/podman/userns.yaml and the cdi_fixtures + # role in environment setup, which must run before this playbook, and the + # openshell_external_driver role in the deb-external-docker-driver + # installer, which always runs after it, so don't pair that installer with + # this environment. - name: Write the configuration delivery mode become: true ansible.builtin.blockinfile: From 002bf18e96416533b8659a5e7e014fbb80397d0a Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 16 Nov 2026 15:44:48 -0800 Subject: [PATCH 8/8] test(tmachine): note the config-push change #5489 requires Signed-off-by: Piotr Mlocek --- tests/tmachine/ansible/playbooks/config-push.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/tmachine/ansible/playbooks/config-push.yaml b/tests/tmachine/ansible/playbooks/config-push.yaml index 1bb982e9dc..8753271dbd 100644 --- a/tests/tmachine/ansible/playbooks/config-push.yaml +++ b/tests/tmachine/ansible/playbooks/config-push.yaml @@ -32,6 +32,11 @@ # openshell_external_driver role in the deb-external-docker-driver # installer, which always runs after it, so don't pair that installer with # this environment. + # + # TODO: https://github.com/NVIDIA/OpenShell/pull/5489 installs this file + # as a gateway.d drop-in config, which must declare `[openshell] + # version = 2`. When it lands, add that table here unless an earlier + # writer already does; TOML rejects a table defined twice. - name: Write the configuration delivery mode become: true ansible.builtin.blockinfile: