[quality] test: BATS coverage for the k8s recipe in files/os/justfile (new tests/unit/os-justfile_test.bats) - #45
Closed
kubestellar-hive[bot] wants to merge 1 commit into
Closed
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
Adds tests/unit/os-justfile_test.bats: 20 cases covering the only executable logic in files/os/justfile -- the k8s recipe. Every invocation runs inside an unprivileged user+mount namespace with tmpfs masks over /etc and /var/lib, and systemctl, systemd-sysext and systemd-sysupdate replaced by logging stubs on PATH, so no host state is touched and no unit is ever enabled. The parse gate fails on the current tree: the cat <<EOF body inside the recipe sits at column 0, which resets just's recipe indentation and makes the closing fi an inconsistent-whitespace error. The behavioural cases skip while that holds, so the suite reports one failure rather than twenty derived ones. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@users.noreply.github.com>
Collaborator
|
Addressed and merged via 7a44c3f with the k8s recipe parse fix. |
castrojo
added a commit
that referenced
this pull request
Sep 5, 2026
, #43) - Replace column-0 heredoc with indentation-safe config writer - Create /etc/rancher/k3s directory with mode 0700 and seed config.yaml with mode 0600 under umask 077 - Add BATS unit tests in tests/unit/os-justfile_test.bats (from PR #45) Closes #44 Closes #43 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed ground
tests/unit/os-justfile_test.bats(test-only; no production file is modified)k8srecipe infiles/os/justfile— sysext acquisition,/etc/rancher/k3s/config.yamlseeding, token handling, sysext merge, server/agent/invalid role dispatch, failure propagationtests/unit/)Disjoint from every open server PR: #41 covers
files/installer/repart.d, #38 coversfiles/bin/system-container, #30 covers.github/scripts/docs-checks.py, #40/#34 are architect element/CI refactors, #36 is sysupdate keying. #37 editsfiles/os/justfileitself (thewrite-kubeconfig-modevalue); this PR adds no change to that file and deliberately asserts only that awrite-kubeconfig-mode:key is seeded, never its value, so it does not conflict with #37 either way.Test Improvement
20 BATS cases. Each invocation runs inside an unprivileged user + mount namespace with tmpfs masks over
/etcand/var/lib;systemctl,systemd-sysextandsystemd-sysupdateare logging stubs onPATH. No host state is touched, no unit is enabled, no OTA is fetched. The suite skips cleanly where namespaces orjustare unavailable.Covered:
/var/lib/extensions/k3s.raw→ sysupdate is or is not invokedsystemd-sysupdatedoes not abort the recipe (|| true)config.yaml; existingconfig.yamlis never overwrittentoken:line; empty/absent token writes nonesystemd-sysext.serviceenabled andsystemd-sysext mergerun; merge failure toleratedserver/agent/ default / unknown / wrong-case role dispatchsystemctl enable --now k3s.servicefails the recipeDefect surfaced
The parse gate fails on the current tree — that failure is the finding, filed as #44:
The
cat <<EOFbody inside the recipe sits at column 0, which resetsjusts recipe indentation and makes the closingfiinconsistent. Reproduced identically on just 1.14.0, 1.25.2, 1.36.0, 1.40.0 and 1.42.4 —just k8shas never been runnable on a shipped image.Quality does not patch production code, so this PR ships tests only. The 18 behavioural cases
skipwhile the justfile is unparseable, so the suite reports exactly one failure instead of twenty derived ones. All 20 were verified green against a locally patched, parseable copy of the recipe; they flip from skip to real coverage the moment #44 is fixed.Related Issues
Refs #44
Refs #42
Filed by quality agent (hold-gated mode). Human review required. Do not merge without addressing #44.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.78