mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
test: Update runtime class detection logic
In the `NodeSupportsPreconfiguredRuntimeClassHandler`, update the check for the runtime handler to return a failure if the `/etc/containerd/config.toml` or `/etc/crio/crio.conf` config files do not exist. If an error is returned, then the underlying test will be skipped. Test manually with starting a kind cluster and moving the containerd config file and verifying that the test is skipped: ``` $ docker exec -it kind-worker /bin/bash root@kind-worker:/# mv /etc/containerd/config.toml /etc/containerd/config.toml.bak ``` ``` make WHAT="test/e2e/e2e.test" $ ./_output/bin/e2e.test -kubeconfig /tmp/kubeconfig_kind -ginkgo.focus=".*should run a Pod requesting a RuntimeClass with a configured handler.*" --num-nodes=1 2>&1 -ginkgo.v=1 | tee -i "/tmp/build-log.txt" [sig-node] RuntimeClass [It] should run a Pod requesting a RuntimeClass with a configured handler [NodeFeature:RuntimeHandler] test/e2e/common/node/runtimeclass.go:85 [SKIPPED] Skipping test as node does not have E2E runtime class handler preconfigured in container runtime config: command terminated with exit code 1 ``` Signed-off-by: David Porter <david@porter.me>
This commit is contained in:
parent
f58f70bd57
commit
83652673b6
@ -69,13 +69,15 @@ func NodeSupportsPreconfiguredRuntimeClassHandler(ctx context.Context, f *framew
|
||||
// If the `runtimes.test-handler` substring is found in the runtime config, it is assumed that the handler is configured.
|
||||
cmd := fmt.Sprintf(`if [ -e '/etc/containerd/config.toml' ]; then
|
||||
grep -q 'runtimes.%s' /etc/containerd/config.toml
|
||||
return
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e '/etc/crio/crio.conf' ]; then
|
||||
grep -q 'runtimes.%s' /etc/crio/crio.conf
|
||||
return
|
||||
exit
|
||||
fi
|
||||
|
||||
exit 1
|
||||
`, PreconfiguredRuntimeClassHandler, PreconfiguredRuntimeClassHandler)
|
||||
|
||||
_, err = hostExec.IssueCommandWithResult(ctx, cmd, node)
|
||||
|
Loading…
Reference in New Issue
Block a user