Skip to content

Commit 6903a84

Browse files
committed
test(tmachine): apply gateway overrides as a drop-in fragment
Install /etc/openshell-test/gateway-overrides.toml as gateway.d/90-test-overrides.toml next to the gateway's base file instead of rewriting the base file with merge-gateway-toml.py. The gateway merges the fragment, so the package's gateway.toml stays untouched and the merge script and its tests are removed. A package with no default configuration still gets a minimal version = 2 base file, since a fragment does not declare a version. Refs #5446 Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 4ef6c6a commit 6903a84

7 files changed

Lines changed: 76 additions & 308 deletions

File tree

‎TESTING.md‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -595,25 +595,24 @@ An environment overrides gateway settings by writing the tables to change to
595595
`/etc/openshell-test/gateway-overrides.toml` in a playbook that runs before the
596596
installer. The file holds whole tables, such as `[openshell.gateway]` or
597597
`[openshell.drivers.podman]`, and is not a complete configuration. Each
598-
installer applies it to the gateway's own file:
598+
installer installs it as the drop-in fragment `gateway.d/90-test-overrides.toml`
599+
next to the gateway's own `gateway.toml`, and the gateway merges it over that
600+
file. The base file is never edited:
599601

600-
- `binaries` applies it to the `/etc/openshell/gateway.toml` it generates.
601-
- `deb` and `rpm` apply it to the service user's
602+
- `binaries` installs it beside the `/etc/openshell/gateway.toml` it generates.
603+
- `deb` and `rpm` install it beside the service user's
602604
`~/.config/openshell/gateway.toml`, the file the packaged service reads. The
603-
file starts as a copy of the rpm's
604-
`/usr/share/openshell-gateway/gateway.toml.default`, where the service would
605-
seed it on first start, or as a minimal `version = 2` file when the package
606-
has no default. No environment replaces the packaged file, and an environment
607-
with no overrides leaves it untouched.
605+
rpm still seeds that file from
606+
`/usr/share/openshell-gateway/gateway.toml.default` on first start. A package
607+
with no default gets a minimal `version = 2` base file, because a fragment
608+
doesn't declare a version. An environment with no overrides leaves the
609+
packaged configuration untouched.
608610
- `k3s` installers ignore the file.
609611

610-
`tests/tmachine/ansible/roles/openshell_gateway/files/merge-gateway-toml.py`
611-
does the work. Each key in the overrides replaces the same key in the table, or
612-
is added to it, and a table the file lacks is appended. The rest of the file,
613-
comments included, stays. The script parses the result and fails the setup,
614-
leaving the file unchanged, when it isn't valid TOML. It can't remove a key.
615-
Settings that the packaged service reads from `gateway.env` instead of the
616-
TOML are not covered.
612+
A key in the fragment replaces the same key in the base file's table, or is
613+
added to it, and a table the base lacks is added. Arrays replace the base
614+
array. A fragment can't remove a key. Settings that the packaged service reads
615+
from `gateway.env` instead of the TOML are not covered.
617616

618617
The `oci-image` feature suite (`tests/suites/features/oci-image`) checks OCI
619618
image identity and working-directory behavior shared by the Docker and Podman

‎tasks/test.toml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ depends = [
2626
"test:maintainer-approval",
2727
"test:cargo-lockfile-alignment",
2828
"test:review-readiness",
29-
"test:merge-gateway-toml",
3029
"test:accepted-work",
3130
]
3231

33-
["test:merge-gateway-toml"]
34-
description = "Test the tmachine gateway TOML merge script"
35-
run = "uv run --no-project --with pytest pytest tests/tmachine/ansible/roles/openshell_gateway/files/merge_gateway_toml_test.py"
36-
3732
["test:cargo-lockfile-alignment"]
3833
description = "Test the Cargo lockfile alignment check"
3934
run = "uv run --no-project --with pytest pytest tasks/scripts/check_cargo_lockfile_alignment_test.py"

‎tests/tmachine/ansible/playbooks/drivers/podman/userns.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
#
66
# `podman_userns_mode` is default, auto, keep-id or private. Every mode except
77
# default writes its `[openshell.drivers.podman]` settings to
8-
# `/etc/openshell-test/gateway-overrides.toml`, which every installer applies to the active
9-
# gateway-overrides.toml (the openshell_gateway role for `binaries`, the
10-
# openshell_packaged_gateway role for the packages); default removes the file. The
8+
# `/etc/openshell-test/gateway-overrides.toml`, which every installer installs as a
9+
# `gateway.d` drop-in next to the active gateway.toml (the openshell_gateway role
10+
# for `binaries`, the openshell_packaged_gateway role for the packages); default
11+
# removes the file. The
1112
# Podman support crate (tests/support/podman) reads the published mode and
1213
# runs Podman's own reference container in it.
1314
---

‎tests/tmachine/ansible/roles/openshell_gateway/files/merge-gateway-toml.py‎

Lines changed: 0 additions & 165 deletions
This file was deleted.

‎tests/tmachine/ansible/roles/openshell_gateway/files/merge_gateway_toml_test.py‎

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)