Wait before start with runtime root test

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2018-08-31 12:30:03 -04:00
parent d5aebde04c
commit a3d3055d75

View File

@ -109,10 +109,10 @@ func newDaemonWithConfig(t *testing.T, configTOML string) (*Client, *daemon, fun
// cleaning config-specific resources is up to the caller // cleaning config-specific resources is up to the caller
} }
return client, &ctrd, cleanup return client, &ctrd, cleanup
} }
func testDaemonRuntimeRoot(t *testing.T, noShim bool) { // TestDaemonRuntimeRoot ensures plugin.linux.runtime_root is not ignored
func TestDaemonRuntimeRoot(t *testing.T) {
runtimeRoot, err := ioutil.TempDir("", "containerd-test-runtime-root") runtimeRoot, err := ioutil.TempDir("", "containerd-test-runtime-root")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -154,6 +154,11 @@ func testDaemonRuntimeRoot(t *testing.T, noShim bool) {
} }
defer task.Delete(ctx) defer task.Delete(ctx)
status, err := task.Wait(ctx)
if err != nil {
t.Fatal(err)
}
if err = task.Start(ctx); err != nil { if err = task.Start(ctx); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -163,23 +168,8 @@ func testDaemonRuntimeRoot(t *testing.T, noShim bool) {
t.Errorf("error while getting stat for %s: %v", stateJSONPath, err) t.Errorf("error while getting stat for %s: %v", stateJSONPath, err)
} }
finishedC, err := task.Wait(ctx)
if err != nil {
t.Fatal(err)
}
if err = task.Kill(ctx, syscall.SIGKILL); err != nil { if err = task.Kill(ctx, syscall.SIGKILL); err != nil {
t.Error(err) t.Error(err)
} }
<-finishedC <-status
}
// TestDaemonRuntimeRoot ensures plugin.linux.runtime_root is not ignored
func TestDaemonRuntimeRoot(t *testing.T) {
testDaemonRuntimeRoot(t, false)
}
// TestDaemonRuntimeRootNoShim ensures plugin.linux.runtime_root is not ignored when no_shim is true
func TestDaemonRuntimeRootNoShim(t *testing.T) {
t.Skip("no_shim is not functional now: https://github.com/containerd/containerd/issues/2181")
testDaemonRuntimeRoot(t, true)
} }