Browse code

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 authored on 2021/01/05 08:58:00
Showing 1 changed files
... ...
@@ -193,7 +193,7 @@ func TestRestartDaemonWithRestartingContainer(t *testing.T) {
193 193
 	defer d.Cleanup(t)
194 194
 
195 195
 	d.StartWithBusybox(t, "--iptables=false")
196
-	defer d.Kill()
196
+	defer d.Stop(t)
197 197
 
198 198
 	ctx := context.Background()
199 199
 	client := d.NewClientT(t)
... ...
@@ -203,8 +203,7 @@ func TestRestartDaemonWithRestartingContainer(t *testing.T) {
203 203
 	// We will manipulate the on disk state later
204 204
 	id := container.Create(ctx, t, client, container.WithRestartPolicy("always"), container.WithCmd("/bin/sh", "-c", "exit 1"))
205 205
 
206
-	// SIGKILL the daemon
207
-	assert.NilError(t, d.Kill())
206
+	d.Stop(t)
208 207
 
209 208
 	configPath := filepath.Join(d.Root, "containers", id, "config.v2.json")
210 209
 	configBytes, err := ioutil.ReadFile(configPath)