Fix rootless e2e test

The install script was starting the service, and then the test itself was restarting it immediately thereafter, which caused frequent flakes.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson
2025-06-12 05:46:21 +00:00
committed by Brad Davidson
parent 5cc51edafa
commit c40bb449ba
2 changed files with 7 additions and 6 deletions

View File

@@ -37,7 +37,7 @@ func StartK3sCluster(nodes []e2e.VagrantNode, serverYAML string) error {
resetCmd := "head -n 3 /etc/rancher/k3s/config.yaml > /tmp/config.yaml && sudo mv /tmp/config.yaml /etc/rancher/k3s/config.yaml"
yamlCmd := fmt.Sprintf("echo '%s' >> /etc/rancher/k3s/config.yaml", serverYAML)
startCmd := "systemctl --user restart k3s-rootless"
startCmd := "systemctl --user start k3s-rootless"
if _, err := node.RunCmdOnNode(resetCmd); err != nil {
return err
@@ -95,9 +95,12 @@ var _ = Describe("Various Startup Configurations", Ordered, func() {
By("CLUSTER CONFIG")
By("OS: " + *nodeOS)
By(tc.Status())
kubeConfigFile, err := GenRootlessKubeconfigFile(tc.Servers[0].String())
Expect(err).NotTo(HaveOccurred())
tc.KubeconfigFile = kubeConfigFile
Eventually(func() error {
kubeConfigFile, err := GenRootlessKubeconfigFile(tc.Servers[0].String())
tc.KubeconfigFile = kubeConfigFile
return err
}, "360s", "5s").Should(Succeed())
})
It("Checks node and pod status", func() {

View File

@@ -54,5 +54,3 @@ systemctl daemon-reload
loginctl enable-linger vagrant
# We need to run this as vagrant user, because rootless k3s will be run as vagrant user
su -c 'XDG_RUNTIME_DIR="/run/user/$UID" DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus" systemctl --user daemon-reload' vagrant
su -c 'XDG_RUNTIME_DIR="/run/user/$UID" DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus" systemctl --user enable --now k3s-rootless' vagrant