diff --git a/test/extended/builds/failure_status.go b/test/extended/builds/failure_status.go index c1c78d017eeb..6ee4e324a864 100644 --- a/test/extended/builds/failure_status.go +++ b/test/extended/builds/failure_status.go @@ -174,14 +174,34 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] update failure status", f var build *buildv1.Build wait.PollImmediate(200*time.Millisecond, 30*time.Second, func() (bool, error) { build, err = oc.BuildClient().BuildV1().Builds(oc.Namespace()).Get(context.Background(), br.Build.Name, metav1.GetOptions{}) - if build.Status.Reason != buildv1.StatusReasonOutOfMemoryKilled { + // In 4.15, status reason may be filed as Error rather than OOMKilled + // (tracked in https://issues.redhat.com/browse/OCPBUGS-32498) and also there is a similar + // discussion in upstream (i.e. https://github.com/kubernetes/kubernetes/issues/119600) which seems to be + // fixed in 4.16. Therefore, we need to loosen the check by also relying on the oomkilled exit code 137 + // to unblock the dependants in 4.15. + if build.Status.Reason != buildv1.StatusReasonOutOfMemoryKilled && build.Status.Reason != buildv1.StatusReasonGenericBuildFailed { return false, nil } return true, nil }) o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(build.Status.Reason).To(o.Equal(buildv1.StatusReasonOutOfMemoryKilled)) - o.Expect(build.Status.Message).To(o.Equal("The build pod was killed due to an out of memory condition.")) + o.Expect(build.Status.Reason).To(o.Or(o.Equal(buildv1.StatusReasonOutOfMemoryKilled), o.Equal(buildv1.StatusReasonGenericBuildFailed))) + if build.Status.Reason == buildv1.StatusReasonOutOfMemoryKilled { + o.Expect(build.Status.Message).To(o.Equal("The build pod was killed due to an out of memory condition.")) + } + + pod, err := oc.KubeClient().CoreV1().Pods(oc.Namespace()).Get(context.Background(), build.Name+"-build", metav1.GetOptions{}) + o.Expect(err).NotTo(o.HaveOccurred()) + oomKilledExitCodeFound := false + for _, c := range pod.Status.ContainerStatuses { + if c.State.Terminated == nil { + continue + } + if c.State.Terminated.ExitCode == 137 { + oomKilledExitCodeFound = true + } + } + o.Expect(oomKilledExitCodeFound).To(o.BeTrue()) exutil.CheckForBuildEvent(oc.KubeClient().CoreV1(), br.Build, BuildFailedEventReason, BuildFailedEventMessage) }) diff --git a/test/extended/testdata/bindata.go b/test/extended/testdata/bindata.go index 07750b150337..2caa331072ca 100644 --- a/test/extended/testdata/bindata.go +++ b/test/extended/testdata/bindata.go @@ -33282,7 +33282,6 @@ os::cmd::expect_failure 'oc get imageStreams nodejs' os::cmd::expect_failure 'oc get imageStreams postgresql' os::cmd::expect_failure 'oc get imageStreams mongodb' os::cmd::expect_failure 'oc get imageStreams wildfly' -os::cmd::try_until_success 'oc get imagestreamTags mariadb:10.3' os::cmd::try_until_success 'oc get imagestreamTags mariadb:10.5' os::cmd::expect_success_and_text "oc get imagestreams mysql --template='{{ index .metadata.annotations \"openshift.io/image.dockerRepositoryCheck\"}}'" '[0-9]{4}\-[0-9]{2}\-[0-9]{2}' # expect a date like YYYY-MM-DD os::cmd::expect_success 'oc describe istag/mysql:latest' @@ -33308,7 +33307,7 @@ echo "imageStreams: ok" os::test::junit::declare_suite_end os::test::junit::declare_suite_start "cmd/images${IMAGES_TESTS_POSTFIX:-}/import-image" -# should follow the latest reference to 10.3 and update that, and leave latest unchanged +# should follow the latest reference to 10.5 and update that, and leave latest unchanged os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.tags 1).from.kind}}'" 'DockerImage' os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.tags 2).from.kind}}'" 'ImageStreamTag' os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.tags 2).from.name}}'" '10.5' @@ -33321,7 +33320,7 @@ os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.t os::cmd::expect_failure_and_text 'oc import-image mariadb --from=quay.io/openshifttest/hello-openshift:openshift' "use the 'tag' command if you want to change the source" os::cmd::expect_success 'oc describe is/mariadb' # import existing tag (explicit) -os::cmd::expect_success_and_text 'oc import-image mariadb:10.3' "sha256:" +os::cmd::expect_success_and_text 'oc import-image mariadb:10.5' "sha256:" os::cmd::expect_success_and_text 'oc import-image mariadb:latest' "sha256:" # import existing image stream creating new tag os::cmd::expect_success_and_text 'oc import-image mariadb:external --from=quay.io/openshifttest/hello-openshift:openshift' "sha256:" @@ -33383,23 +33382,23 @@ os::cmd::expect_success_and_text "oc get istag/mariadb:labeled -o jsonpath='{.me # test copying tags os::cmd::expect_success 'oc tag quay.io/openshift/origin-cli:4.6 newrepo:latest' os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).from.kind}}'" 'DockerImage' -os::cmd::try_until_success 'oc get istag/mariadb:10.3' +os::cmd::try_until_success 'oc get istag/mariadb:10.5' # default behavior is to copy the current image, but since this is an external image we preserve the dockerImageReference -os::cmd::expect_success 'oc tag mariadb:10.3 newrepo:latest' +os::cmd::expect_success 'oc tag mariadb:10.5 newrepo:latest' os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).from.kind}}'" 'ImageStreamImage' -os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .status.tags 0 \"items\" 0).dockerImageReference}}'" '^quay.io/centos7/mariadb-103-centos7@sha256:' +os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .status.tags 0 \"items\" 0).dockerImageReference}}'" '^quay.io/centos7/mariadb-105-centos7@sha256:' # when copying a tag that points to the internal registry, update the container image reference #os::cmd::expect_success "oc tag test:new newrepo:direct" #os::cmd::expect_success_and_text 'oc get istag/newrepo:direct -o jsonpath={.image.dockerImageReference}' "/$project/newrepo@sha256:" # test references -os::cmd::expect_success 'oc tag mariadb:10.3 reference:latest --reference' +os::cmd::expect_success 'oc tag mariadb:10.5 reference:latest --reference' os::cmd::expect_success_and_text "oc get is/reference --template='{{(index .spec.tags 0).from.kind}}'" 'ImageStreamImage' os::cmd::expect_success_and_text "oc get is/reference --template='{{(index .spec.tags 0).reference}}'" 'true' # create a second project to test tagging across projects os::cmd::expect_success 'oc new-project test-cmd-images-2' -os::cmd::expect_success "oc tag $project/mariadb:10.3 newrepo:latest" +os::cmd::expect_success "oc tag $project/mariadb:10.5 newrepo:latest" os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).from.kind}}'" 'ImageStreamImage' -os::cmd::expect_success_and_text 'oc get istag/newrepo:latest -o jsonpath={.image.dockerImageReference}' 'quay.io/centos7/mariadb-103-centos7@sha256:' +os::cmd::expect_success_and_text 'oc get istag/newrepo:latest -o jsonpath={.image.dockerImageReference}' 'quay.io/centos7/mariadb-105-centos7@sha256:' # tag across projects without specifying the source's project os::cmd::expect_success_and_text "oc tag newrepo:latest '${project}/mariadb:tag1'" "mariadb:tag1 set to" os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).name}}'" "latest" diff --git a/test/extended/testdata/cmd/test/cmd/images.sh b/test/extended/testdata/cmd/test/cmd/images.sh index b47bffe1a15b..a6796517e03d 100755 --- a/test/extended/testdata/cmd/test/cmd/images.sh +++ b/test/extended/testdata/cmd/test/cmd/images.sh @@ -132,7 +132,6 @@ os::cmd::expect_failure 'oc get imageStreams nodejs' os::cmd::expect_failure 'oc get imageStreams postgresql' os::cmd::expect_failure 'oc get imageStreams mongodb' os::cmd::expect_failure 'oc get imageStreams wildfly' -os::cmd::try_until_success 'oc get imagestreamTags mariadb:10.3' os::cmd::try_until_success 'oc get imagestreamTags mariadb:10.5' os::cmd::expect_success_and_text "oc get imagestreams mysql --template='{{ index .metadata.annotations \"openshift.io/image.dockerRepositoryCheck\"}}'" '[0-9]{4}\-[0-9]{2}\-[0-9]{2}' # expect a date like YYYY-MM-DD os::cmd::expect_success 'oc describe istag/mysql:latest' @@ -158,7 +157,7 @@ echo "imageStreams: ok" os::test::junit::declare_suite_end os::test::junit::declare_suite_start "cmd/images${IMAGES_TESTS_POSTFIX:-}/import-image" -# should follow the latest reference to 10.3 and update that, and leave latest unchanged +# should follow the latest reference to 10.5 and update that, and leave latest unchanged os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.tags 1).from.kind}}'" 'DockerImage' os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.tags 2).from.kind}}'" 'ImageStreamTag' os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.tags 2).from.name}}'" '10.5' @@ -171,7 +170,7 @@ os::cmd::expect_success_and_text "oc get is/mariadb --template='{{(index .spec.t os::cmd::expect_failure_and_text 'oc import-image mariadb --from=quay.io/openshifttest/hello-openshift:openshift' "use the 'tag' command if you want to change the source" os::cmd::expect_success 'oc describe is/mariadb' # import existing tag (explicit) -os::cmd::expect_success_and_text 'oc import-image mariadb:10.3' "sha256:" +os::cmd::expect_success_and_text 'oc import-image mariadb:10.5' "sha256:" os::cmd::expect_success_and_text 'oc import-image mariadb:latest' "sha256:" # import existing image stream creating new tag os::cmd::expect_success_and_text 'oc import-image mariadb:external --from=quay.io/openshifttest/hello-openshift:openshift' "sha256:" @@ -233,23 +232,23 @@ os::cmd::expect_success_and_text "oc get istag/mariadb:labeled -o jsonpath='{.me # test copying tags os::cmd::expect_success 'oc tag quay.io/openshift/origin-cli:4.6 newrepo:latest' os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).from.kind}}'" 'DockerImage' -os::cmd::try_until_success 'oc get istag/mariadb:10.3' +os::cmd::try_until_success 'oc get istag/mariadb:10.5' # default behavior is to copy the current image, but since this is an external image we preserve the dockerImageReference -os::cmd::expect_success 'oc tag mariadb:10.3 newrepo:latest' +os::cmd::expect_success 'oc tag mariadb:10.5 newrepo:latest' os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).from.kind}}'" 'ImageStreamImage' -os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .status.tags 0 \"items\" 0).dockerImageReference}}'" '^quay.io/centos7/mariadb-103-centos7@sha256:' +os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .status.tags 0 \"items\" 0).dockerImageReference}}'" '^quay.io/centos7/mariadb-105-centos7@sha256:' # when copying a tag that points to the internal registry, update the container image reference #os::cmd::expect_success "oc tag test:new newrepo:direct" #os::cmd::expect_success_and_text 'oc get istag/newrepo:direct -o jsonpath={.image.dockerImageReference}' "/$project/newrepo@sha256:" # test references -os::cmd::expect_success 'oc tag mariadb:10.3 reference:latest --reference' +os::cmd::expect_success 'oc tag mariadb:10.5 reference:latest --reference' os::cmd::expect_success_and_text "oc get is/reference --template='{{(index .spec.tags 0).from.kind}}'" 'ImageStreamImage' os::cmd::expect_success_and_text "oc get is/reference --template='{{(index .spec.tags 0).reference}}'" 'true' # create a second project to test tagging across projects os::cmd::expect_success 'oc new-project test-cmd-images-2' -os::cmd::expect_success "oc tag $project/mariadb:10.3 newrepo:latest" +os::cmd::expect_success "oc tag $project/mariadb:10.5 newrepo:latest" os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).from.kind}}'" 'ImageStreamImage' -os::cmd::expect_success_and_text 'oc get istag/newrepo:latest -o jsonpath={.image.dockerImageReference}' 'quay.io/centos7/mariadb-103-centos7@sha256:' +os::cmd::expect_success_and_text 'oc get istag/newrepo:latest -o jsonpath={.image.dockerImageReference}' 'quay.io/centos7/mariadb-105-centos7@sha256:' # tag across projects without specifying the source's project os::cmd::expect_success_and_text "oc tag newrepo:latest '${project}/mariadb:tag1'" "mariadb:tag1 set to" os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).name}}'" "latest"