Commit Graph
5 Commits
Author SHA1 Message Date
Myasnikov Daniil cc942fed68 test(tests): run unit suites with Bats and retain POSIX coverage
The shell translator rewrites test bodies and loses Bats reporting.
The unit lane needs complete TAP results and JUnit reports without
changing how live-cluster suites run.

Sourced production helpers still need a dash pass, and unit test bodies
need nounset without exporting shell options into subprocesses.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-10-07 11:04:00 +03:00
Aleksei Sviridkin ceccac27b0 test(hack): clean up bats temp dirs without EXIT traps
A `trap ... EXIT` inside an `@test` replaces the one the bats binary
installs for its own bookkeeping, so a test that then fails prints no
TAP line at all. Not `not ok`, nothing: the run ends with a warning
that N of M tests executed, and anyone judging it by grepping for
`not ok` reads a green suite. Cleanup moves to the last line of each
body instead. Both runners set -e, so a failed test leaves its scratch
directory behind, which is what you want to look at anyway.

hack/promote-retag_test.bats was failing this way already, reporting
five passes and no failures while six of its eleven tests printed
nothing. Those six invoke the script for real, and it requires
sha256sum; they pin PATH to the stub directory plus /usr/bin and /bin,
which is where coreutils installs that binary and where macOS does not,
so the failure was of the platform rather than of the code and CI never
saw it. The stub directory already supplied yq and skopeo for the same
reason and now supplies sha256sum too, resolved from absolute
candidates because the stub itself is first on PATH.

Two file headers described the trap arrangement they no longer use and
are corrected rather than left to outlive it.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-08-05 16:03:57 +03:00
Aleksei Sviridkin 9352d3ee0e feat(gpu-operator): add container variant for preinstalled host driver
The two existing variants assume the host has neither the NVIDIA driver
nor the container toolkit: default unbinds the host driver to bind
vfio-pci for KubeVirt VMs, vgpu requires the proprietary vGPU host
driver and a license server. Neither path produces a working setup on a
node that already ships the driver and nvidia-container-toolkit via the
distro package manager — the most common shape of a Linux GPU node.

The new container variant surfaces the third architectural mode that
upstream NVIDIA gpu-operator already supports: sandboxWorkloads
disabled, devicePlugin enabled, with every component that would
conflict with the host install switched off.

- driver.enabled=false        use the host driver
- toolkit.enabled=false       host already has nvidia-container-toolkit;
                              enabling overwrites the containerd
                              config.toml the host configured via
                              nvidia-ctk runtime configure
- devicePlugin.enabled=true   publish nvidia.com/gpu to the kubelet
- vfioManager.enabled=false   do not unbind the host driver
- cdi.enabled=false           CDI spec generation is serviced by the
                              disabled toolkit; an apt host uses the
                              legacy nvidia-container-runtime hook, so
                              pin off to match the host runtime wiring
- sandboxWorkloads.enabled=false   regular pod workloads, not VMs

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-06-08 16:58:51 +03:00
Aleksei Sviridkin c24a507911 test(gpu-operator): make variants bats test runnable under cozytest.sh
Build job in CI failed because the test relied on bats-specific
machinery the in-repo cozytest.sh runner does not provide:

* BATS_TEST_DIRNAME is undefined when the file is sourced as a plain
  shell script (cozytest.sh's mode); switch to BATS_TEST_FILENAME
  with a $0 fallback, matching hack/check-gpu-recording-rules.bats
  (REPO_ROOT pattern).
* setup()/teardown() are bats lifecycle hooks; cozytest.sh runs each
  @test in a fresh subshell with set -u and never invokes them. With
  TMP only assigned in setup(), every test exited immediately on
  'TMP: unbound variable'. Inline the mktemp + trap inside each
  @test so both runners work the same.

Verified locally that bash hack/cozytest.sh hack/check-gpu-operator-variants.bats
now reports all six tests OK.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-04-30 14:55:54 +03:00
Aleksei Sviridkin 4a16c84832 test(gpu-operator): assert variant overlays render expected ClusterPolicy
Adds hack/check-gpu-operator-variants.bats. The test renders both
package variants with helm template and asserts the resulting
ClusterPolicy spec for the values that this PR cares about:

  * ccManager.enabled=false (pinned in values.yaml; upstream v26 default
    was flipped to true)
  * vgpuDeviceManager.enabled=false (same — and on Ada+/Blackwell the
    DaemonSet would crashloop because /sys/class/mdev_bus is empty)
  * sandboxWorkloads.defaultWorkload — vm-passthrough on the default
    variant, vm-vgpu on the vgpu variant; without these the upstream
    'container' default makes either variant a silent no-op on
    unlabelled GPU nodes
  * vgpuManager.enabled=true on the vgpu variant; driver / devicePlugin
    enabled=false on both variants (proprietary host driver path is
    out of scope for both passthrough and SR-IOV vGPU)

Negative-tested locally: deleting any of these settings makes the
corresponding test fail, so it actually guards regressions on the
next chart bump.

Also addresses last-pass review comments:

  * values-passthrough.yaml: set sandboxWorkloads.defaultWorkload=
    vm-passthrough so the default variant is symmetric with the vgpu
    variant — neither relies on per-node labels for the variant to
    activate. Without this the upstream default 'container' would
    apply on unlabelled GPU nodes and vfio-manager would never start.
  * values.yaml: rewrite the vgpuDeviceManager comment to lead with
    the load-bearing reason (mdev path missing on Ada+/Blackwell)
    instead of the secondary 'stays at zero pods on passthrough'
    rationalisation.
  * docs/gpu-vgpu.md: add a 'Migrating from chart v25.x' subsection
    in the Licensing section pointing at the configMapName ->
    secretName rename. Old key still works upstream but emits a
    deprecation warning; PR body release note already calls this out
    but the docs were missing the migration breadcrumb.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-04-30 14:52:56 +03:00