Skip to content

Commit

Permalink
Use --kubelet-root-dir in reset inttest
Browse files Browse the repository at this point in the history
Signed-off-by: Natanael Copa <ncopa@mirantis.com>
  • Loading branch information
ncopa committed Nov 7, 2024
1 parent 2a4a99e commit adcc12e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inttest/reset/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *suite) TestReset() {

if ok := s.Run("k0s gets up", func() {
s.Require().NoError(s.InitController(0, "--disable-components=konnectivity-server,metrics-server"))
s.Require().NoError(s.RunWorkers())
s.Require().NoError(s.RunWorkers("--kubelet-root-dir=/var/lib/kubelet"))

kc, err := s.KubeClient(s.ControllerNode(0))
s.Require().NoError(err)
Expand All @@ -55,18 +55,20 @@ func (s *suite) TestReset() {

s.NoError(ssh.Exec(ctx, "test -d /var/lib/k0s", common.SSHStreams{}), "/var/lib/k0s is not a directory")
s.NoError(ssh.Exec(ctx, "test -d /run/k0s", common.SSHStreams{}), "/run/k0s is not a directory")
s.NoError(ssh.Exec(ctx, "test -d /var/lib/kubelet", common.SSHStreams{}), "/var/lib/kubelet is not a directory")

s.NoError(ssh.Exec(ctx, "pidof containerd-shim-runc-v2 >&2", common.SSHStreams{}), "Expected some running containerd shims")

s.NoError(s.StopWorker(workerNode), "Failed to stop k0s")

streams, flushStreams := common.TestLogStreams(s.T(), "reset")
err = ssh.Exec(ctx, "k0s reset --debug", streams)
err = ssh.Exec(ctx, "k0s reset --debug --kubelet-root-dir=/var/lib/kubelet", streams)
flushStreams()
s.NoError(err, "k0s reset didn't exit cleanly")

// /var/lib/k0s is a mount point in the Docker container and can't be deleted, so it must be empty
s.NoError(ssh.Exec(ctx, `x="$(ls -A /var/lib/k0s)" && echo "$x" >&2 && [ -z "$x" ]`, common.SSHStreams{}), "/var/lib/k0s is not empty")
s.NoError(ssh.Exec(ctx, "! test -e /var/lib/kubelet", common.SSHStreams{}), "/var/lib/kubelet still exists")
s.NoError(ssh.Exec(ctx, "! test -e /run/k0s", common.SSHStreams{}), "/run/k0s still exists")
s.NoError(ssh.Exec(ctx, "! pidof containerd-shim-runc-v2 >&2", common.SSHStreams{}), "Expected no running containerd shims")
})
Expand Down

0 comments on commit adcc12e

Please sign in to comment.