Browse code

Merge pull request #36662 from adshmh/use-unique-resource-names-for-container-inspect-ps-stop-integration-tests

Use unique names for test resources of container/inspect, container/ps, container/stop tests

Akihiro Suda authored on 2018/03/23 12:16:53
Showing 3 changed files
... ...
@@ -22,7 +22,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
22 22
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
23 23
 	ctx := context.Background()
24 24
 
25
-	name := "cpusetinconfig-pre120"
25
+	name := "cpusetinconfig-pre120-" + t.Name()
26 26
 	// Create container with up to-date-API
27 27
 	container.Run(t, ctx, request.NewAPIClient(t), container.WithName(name),
28 28
 		container.WithCmd("true"),
... ...
@@ -17,9 +17,10 @@ func TestPsFilter(t *testing.T) {
17 17
 	client := request.NewAPIClient(t)
18 18
 	ctx := context.Background()
19 19
 
20
-	prev := container.Create(t, ctx, client, container.WithName("prev"))
21
-	container.Create(t, ctx, client, container.WithName("top"))
22
-	next := container.Create(t, ctx, client, container.WithName("next"))
20
+	prev := container.Create(t, ctx, client, container.WithName("prev-"+t.Name()))
21
+	topContainerName := "top-" + t.Name()
22
+	container.Create(t, ctx, client, container.WithName(topContainerName))
23
+	next := container.Create(t, ctx, client, container.WithName("next-"+t.Name()))
23 24
 
24 25
 	containerIDs := func(containers []types.Container) []string {
25 26
 		entries := []string{}
... ...
@@ -30,7 +31,7 @@ func TestPsFilter(t *testing.T) {
30 30
 	}
31 31
 
32 32
 	f1 := filters.NewArgs()
33
-	f1.Add("since", "top")
33
+	f1.Add("since", topContainerName)
34 34
 	q1, err := client.ContainerList(ctx, types.ContainerListOptions{
35 35
 		All:     true,
36 36
 		Filters: f1,
... ...
@@ -39,7 +40,7 @@ func TestPsFilter(t *testing.T) {
39 39
 	assert.Check(t, is.Contains(containerIDs(q1), next))
40 40
 
41 41
 	f2 := filters.NewArgs()
42
-	f2.Add("before", "top")
42
+	f2.Add("before", topContainerName)
43 43
 	q2, err := client.ContainerList(ctx, types.ContainerListOptions{
44 44
 		All:     true,
45 45
 		Filters: f2,
... ...
@@ -21,7 +21,7 @@ func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
21 21
 	client := request.NewAPIClient(t)
22 22
 	ctx := context.Background()
23 23
 
24
-	names := []string{"verifyRestart1", "verifyRestart2"}
24
+	names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
25 25
 	for _, name := range names {
26 26
 		container.Run(t, ctx, client, container.WithName(name), container.WithCmd("false"), func(c *container.TestContainerConfig) {
27 27
 			c.HostConfig.RestartPolicy.Name = "always"
... ...
@@ -49,7 +49,7 @@ func TestDeleteDevicemapper(t *testing.T) {
49 49
 	client := request.NewAPIClient(t)
50 50
 	ctx := context.Background()
51 51
 
52
-	id := container.Run(t, ctx, client, container.WithName("foo"), container.WithCmd("echo"))
52
+	id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
53 53
 
54 54
 	poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond))
55 55