Skip to content

Commit

Permalink
test: stop containerd before accessing the stdout
Browse files Browse the repository at this point in the history
The variable `buf` is connected to containerd's stdout. So, accessing
the variable before killing containerd can cause a race condition.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
  • Loading branch information
kzys committed Feb 3, 2021
1 parent f07e181 commit 310e590
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client_test.go
Expand Up @@ -139,9 +139,9 @@ func TestMain(m *testing.M) {
// pull a seed image
log.G(ctx).WithField("image", testImage).Info("start to pull seed image")
if _, err = client.Pull(ctx, testImage, WithPullUnpack); err != nil {
fmt.Fprintf(os.Stderr, "%s: %s\n", err, buf.String())
ctrd.Kill()
ctrd.Wait()
fmt.Fprintf(os.Stderr, "%s: %s\n", err, buf.String())
os.Exit(1)
}

Expand Down

0 comments on commit 310e590

Please sign in to comment.