Selaa lähdekoodia

Make test work with rootless mode

Using `d.Kill()` with rootless mode causes the restarted daemon to not
be able to start containerd (it times out).

Originally this was SIGKILLing the daemon because we were hoping to not
have to manipulate on disk state, but since we need to anyway we can
shut it down normally.

I also tested this to ensure the test fails correctly without the fix
that the test was added to check for.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit e6591a9c7abf8bfef8e8c4f1f560c13acf342f4a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Brian Goff 4 vuotta sitten
vanhempi
commit
f0e526f43e
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      integration/container/daemon_linux_test.go

+ 2 - 3
integration/container/daemon_linux_test.go

@@ -193,7 +193,7 @@ func TestRestartDaemonWithRestartingContainer(t *testing.T) {
 	defer d.Cleanup(t)
 	defer d.Cleanup(t)
 
 
 	d.StartWithBusybox(t, "--iptables=false")
 	d.StartWithBusybox(t, "--iptables=false")
-	defer d.Kill()
+	defer d.Stop(t)
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 	client := d.NewClientT(t)
 	client := d.NewClientT(t)
@@ -203,8 +203,7 @@ func TestRestartDaemonWithRestartingContainer(t *testing.T) {
 	// We will manipulate the on disk state later
 	// We will manipulate the on disk state later
 	id := container.Create(ctx, t, client, container.WithRestartPolicy("always"), container.WithCmd("/bin/sh", "-c", "exit 1"))
 	id := container.Create(ctx, t, client, container.WithRestartPolicy("always"), container.WithCmd("/bin/sh", "-c", "exit 1"))
 
 
-	// SIGKILL the daemon
-	assert.NilError(t, d.Kill())
+	d.Stop(t)
 
 
 	configPath := filepath.Join(d.Root, "containers", id, "config.v2.json")
 	configPath := filepath.Join(d.Root, "containers", id, "config.v2.json")
 	configBytes, err := ioutil.ReadFile(configPath)
 	configBytes, err := ioutil.ReadFile(configPath)