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
This commit is contained in:
commit
57c504799d
|
@ -22,7 +22,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
|
||||||
client := request.NewAPIClient(t, client.WithVersion("1.19"))
|
client := request.NewAPIClient(t, client.WithVersion("1.19"))
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
name := "cpusetinconfig-pre120"
|
name := "cpusetinconfig-pre120-" + t.Name()
|
||||||
// Create container with up to-date-API
|
// Create container with up to-date-API
|
||||||
container.Run(t, ctx, request.NewAPIClient(t), container.WithName(name),
|
container.Run(t, ctx, request.NewAPIClient(t), container.WithName(name),
|
||||||
container.WithCmd("true"),
|
container.WithCmd("true"),
|
||||||
|
|
|
@ -17,9 +17,10 @@ func TestPsFilter(t *testing.T) {
|
||||||
client := request.NewAPIClient(t)
|
client := request.NewAPIClient(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
prev := container.Create(t, ctx, client, container.WithName("prev"))
|
prev := container.Create(t, ctx, client, container.WithName("prev-"+t.Name()))
|
||||||
container.Create(t, ctx, client, container.WithName("top"))
|
topContainerName := "top-" + t.Name()
|
||||||
next := container.Create(t, ctx, client, container.WithName("next"))
|
container.Create(t, ctx, client, container.WithName(topContainerName))
|
||||||
|
next := container.Create(t, ctx, client, container.WithName("next-"+t.Name()))
|
||||||
|
|
||||||
containerIDs := func(containers []types.Container) []string {
|
containerIDs := func(containers []types.Container) []string {
|
||||||
entries := []string{}
|
entries := []string{}
|
||||||
|
@ -30,7 +31,7 @@ func TestPsFilter(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
f1 := filters.NewArgs()
|
f1 := filters.NewArgs()
|
||||||
f1.Add("since", "top")
|
f1.Add("since", topContainerName)
|
||||||
q1, err := client.ContainerList(ctx, types.ContainerListOptions{
|
q1, err := client.ContainerList(ctx, types.ContainerListOptions{
|
||||||
All: true,
|
All: true,
|
||||||
Filters: f1,
|
Filters: f1,
|
||||||
|
@ -39,7 +40,7 @@ func TestPsFilter(t *testing.T) {
|
||||||
assert.Check(t, is.Contains(containerIDs(q1), next))
|
assert.Check(t, is.Contains(containerIDs(q1), next))
|
||||||
|
|
||||||
f2 := filters.NewArgs()
|
f2 := filters.NewArgs()
|
||||||
f2.Add("before", "top")
|
f2.Add("before", topContainerName)
|
||||||
q2, err := client.ContainerList(ctx, types.ContainerListOptions{
|
q2, err := client.ContainerList(ctx, types.ContainerListOptions{
|
||||||
All: true,
|
All: true,
|
||||||
Filters: f2,
|
Filters: f2,
|
||||||
|
|
|
@ -21,7 +21,7 @@ func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
|
||||||
client := request.NewAPIClient(t)
|
client := request.NewAPIClient(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
names := []string{"verifyRestart1", "verifyRestart2"}
|
names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
container.Run(t, ctx, client, container.WithName(name), container.WithCmd("false"), func(c *container.TestContainerConfig) {
|
container.Run(t, ctx, client, container.WithName(name), container.WithCmd("false"), func(c *container.TestContainerConfig) {
|
||||||
c.HostConfig.RestartPolicy.Name = "always"
|
c.HostConfig.RestartPolicy.Name = "always"
|
||||||
|
@ -49,7 +49,7 @@ func TestDeleteDevicemapper(t *testing.T) {
|
||||||
client := request.NewAPIClient(t)
|
client := request.NewAPIClient(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
id := container.Run(t, ctx, client, container.WithName("foo"), container.WithCmd("echo"))
|
id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
|
||||||
|
|
||||||
poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond))
|
poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue