engine integ test: serial image pull
Added an integ test to cover serial image pull logic
@@ -35,6 +35,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
docker "github.com/fsouza/go-dockerclient"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
const (
@@ -798,3 +799,31 @@ func TestStartStopWithSecurityOptionNoNewPrivileges(t *testing.T) {
verifyContainerStoppedStateChange(t, taskEngine)
verifyTaskStoppedStateChange(t, taskEngine)
}
+
+// TestSerialImagePull tests the serial pull image behavior of the agent
+func TestSerialImagePull(t *testing.T) {
+ taskEngine, done, _ := setupWithDefaultConfig(t)
+ defer done()
+
+ // Force enable serial pull
+ dockerTaskEngine, ok := taskEngine.(*DockerTaskEngine)
+ require.True(t, ok)
+ dockerTaskEngine.enableConcurrentPull = false
+
+ // Ensure this image isn't pulled by deleting it
+ removeImage(testRegistryImage)
+ removeImage(testBusyboxImage)
+
+ testTask := createTestTask("testSerialImagePull")
+ testTask.Containers = append(testTask.Containers,
+ createTestContainerWithImageAndName(testBusyboxImage, "busybox"))
+
+ go taskEngine.AddTask(testTask)
+
+ verifyContainerRunningStateChange(t, taskEngine)
+ verifyContainerRunningStateChange(t, taskEngine)
+ verifyTaskRunningStateChange(t, taskEngine)
+ verifyContainerStoppedStateChange(t, taskEngine)
+ verifyContainerStoppedStateChange(t, taskEngine)
+ verifyTaskStoppedStateChange(t, taskEngine)
+}
