functional tests: validator pull image update
If we set "prefer-cached" as the pull behavior, then the PullStartedAt
and PullStoppedAt fields may not be present in the endpoint. This
causes tests to fail. This change logs an error but prevents that
specific failure case.
@@ -170,7 +170,7 @@ func verifyTaskMetadataResponse(taskMetadataRawMsg json.RawMessage) error {
"KnownStatus": "RUNNING",
}
- taskExpectedFieldNotEmptyArray := []string{"Cluster", "TaskARN", "Family", "Revision", "PullStartedAt", "PullStoppedAt", "Containers", "AvailabilityZone"}
+ taskExpectedFieldNotEmptyArray := []string{"Cluster", "TaskARN", "Family", "Revision", "Containers", "AvailabilityZone"}
if checkContainerInstanceTags {
taskExpectedFieldNotEmptyArray = append(taskExpectedFieldNotEmptyArray, "ContainerInstanceTags")
}
@@ -187,6 +187,14 @@ func verifyTaskMetadataResponse(taskMetadataRawMsg json.RawMessage) error {
}
}
+ // When pull behavior is set to 'prefer-cached', the pull values are unset
+ // TODO: figure out how to test both conditions on windows.
+ for _, fieldName := range []string{"PullStartedAt", "PullStoppedAt"} {
+ if err = fieldNotEmpty(taskMetadataResponseMap, fieldName); err != nil {
+ fmt.Printf("WARN: '%s' is not set, but this value isn't expected when pull is disabled.", fieldName)
+ }
+ }
+
var containersMetadataResponseArray []json.RawMessage
json.Unmarshal(taskMetadataResponseMap["Containers"], &containersMetadataResponseArray)
