Skip to content

Commit 310e590

Browse files
author
Kazuyoshi Kato
committed
test: stop containerd before accessing the stdout
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 <[email protected]>
1 parent f07e181 commit 310e590

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ func TestMain(m *testing.M) {
139139
// pull a seed image
140140
log.G(ctx).WithField("image", testImage).Info("start to pull seed image")
141141
if _, err = client.Pull(ctx, testImage, WithPullUnpack); err != nil {
142-
fmt.Fprintf(os.Stderr, "%s: %s\n", err, buf.String())
143142
ctrd.Kill()
144143
ctrd.Wait()
144+
fmt.Fprintf(os.Stderr, "%s: %s\n", err, buf.String())
145145
os.Exit(1)
146146
}
147147

0 commit comments

Comments
 (0)