summaryrefslogtreecommitdiffhomepage
path: root/runsc/container/container_test.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-11-07 21:30:11 -0800
committerShentubot <shentubot@google.com>2018-11-07 21:30:59 -0800
commitd12a0dd6b8afaca9fbb5fe60fb84a3ae0502261a (patch)
tree6512e9420c38e6f8cc50c474d66ff267d402fbf9 /runsc/container/container_test.go
parent13b48f2e6a186321084fa8159e8cc2659ed221a2 (diff)
Fix test --race violation
SetupContainerInRoot was setting Config.RootDir unnecessarily and causing a --race violation in TestMultiContainerDestroyStarting. PiperOrigin-RevId: 220580073 Change-Id: Ie0b28c19846106c7458a92681b708ae70f87d25a
Diffstat (limited to 'runsc/container/container_test.go')
-rw-r--r--runsc/container/container_test.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go
index 64def7eed..598b96a08 100644
--- a/runsc/container/container_test.go
+++ b/runsc/container/container_test.go
@@ -1287,24 +1287,25 @@ func TestReadonlyMount(t *testing.T) {
// TestAbbreviatedIDs checks that runsc supports using abbreviated container
// IDs in place of full IDs.
func TestAbbreviatedIDs(t *testing.T) {
+ rootDir, err := testutil.SetupRootDir()
+ if err != nil {
+ t.Fatalf("error creating root dir: %v", err)
+ }
+ defer os.RemoveAll(rootDir)
+
+ conf := testutil.TestConfigWithRoot(rootDir)
+
cids := []string{
"foo-" + testutil.UniqueContainerID(),
"bar-" + testutil.UniqueContainerID(),
"baz-" + testutil.UniqueContainerID(),
}
-
- rootDir, err := testutil.SetupRootDir()
- if err != nil {
- t.Fatalf("error creating root dir: %v", err)
- }
for _, cid := range cids {
spec := testutil.NewSpecWithArgs("sleep", "100")
- conf := testutil.TestConfig()
- bundleDir, err := testutil.SetupContainerInRoot(rootDir, spec, conf)
+ bundleDir, err := testutil.SetupBundleDir(spec)
if err != nil {
t.Fatalf("error setting up container: %v", err)
}
- defer os.RemoveAll(rootDir)
defer os.RemoveAll(bundleDir)
// Create and start the container.