Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd test flake: new-app: expecting success and not text '"ruby:latest" already exists #20519

Closed
gabemontero opened this issue Aug 2, 2018 · 4 comments · Fixed by #20521
Closed
Assignees
Labels
kind/test-flake Categorizes issue or PR as related to test flakes. priority/P2 sig/developer-experience

Comments

@gabemontero
Copy link
Contributor

=== BEGIN TEST CASE ===
test/cmd/newapp.sh:440: executing 'oc new-app docker.io/ruby:latest~https://github.com/sclorg/ruby-ex.git --name=testapp2 --strategy=docker' expecting success and not text '"ruby:latest" already exists'
FAILURE after 0.898s: test/cmd/newapp.sh:440: executing 'oc new-app docker.io/ruby:latest~https://github.com/sclorg/ruby-ex.git --name=testapp2 --strategy=docker' expecting success and not text '"ruby:latest" already exists': the command returned the wrong error code; the output content test failed
Standard output from the command:
--> Found Docker image 1d8640b (12 days old) from docker.io for "docker.io/ruby:latest"

    * An image stream tag will be created as "ruby:latest" that will track the source image
    * A Docker build using source code from https://github.com/sclorg/ruby-ex.git will be created
      * The resulting image will be pushed to image stream tag "testapp2:latest"
      * Every time "ruby:latest" changes a new build will be triggered
    * This image will be deployed in deployment config "testapp2"
    * The image does not expose any ports - if you want to load balance or send traffic to this component
      you will need to create a service with 'expose dc/testapp2 --port=[port]' later
    * WARNING: Image "docker.io/ruby:latest" runs as the 'root' user which may not be permitted by your cluster administrator

--> Creating resources ...
    imagestream.image.openshift.io "testapp2" created
    buildconfig.build.openshift.io "testapp2" created
    deploymentconfig.apps.openshift.io "testapp2" created
--> Failed

Standard error from the command:
    error: imagestreamtag.image.openshift.io "ruby:latest" already exists
=== END TEST CASE ===

@openshift/sig-developer-experience fyi

@coreydaley - am I remembering correctly you recently merged some changes around IS reuse with new-app?

https://openshift-gce-devel.appspot.com/build/origin-ci-test/pr-logs/pull/20492/test_pull_request_origin_cmd/16415/

from

#20492

@coreydaley
Copy link
Member

@gabemontero @bparees Yes, I did.
The issue seems to be that using oc cluster up to bring up the cluster, and then running the newapp.sh tests fails because oc cluster up creates the ruby:latest, you have to delete all of the imagestreams and templates from the openshift namespace for it to run correctly :(

@bparees
Copy link
Contributor

bparees commented Aug 2, 2018

The issue seems to be that using oc cluster up to bring up the cluster, and then running the newapp.sh tests fails because oc cluster up creates the ruby:latest, you have to delete all of the imagestreams and templates from the openshift namespace for it to run correctly :(

why? new-app should never be creating anything in the openshift namespace, only in the current namespace (which is not openshift if you look at the newapp.sh flow).

@bparees
Copy link
Contributor

bparees commented Aug 2, 2018

@coreydaley the whole point of the test is to confirm that new-app does not try to create a "ruby:latest" imagestream (in the current project):

# newapp does not attempt to create an imagestream that already exists for a Docker image
os::cmd::expect_success_and_text 'oc new-app docker.io/ruby:latest~https://github.com/sclorg/ruby-ex.git --name=testapp1 --strategy=docker' 'imagestream.image.openshift.io "ruby" created'
os::cmd::expect_success_and_not_text 'oc new-app docker.io/ruby:latest~https://github.com/sclorg/ruby-ex.git --name=testapp2 --strategy=docker' '"ruby:latest" already exists'

@bparees
Copy link
Contributor

bparees commented Aug 2, 2018

it's possible there is a race here in which the imagestreamtag that was created in the first command, is not seen by the second command (hence why it tries to create it and then fails).

That might be the case if the "ruby:latest" IST that was created hasn't yet imported by the time the second new-app runs. So the first thing to do here might be to add this in between the two new-apps:

os::cmd::try_until_success 'oc get imagestreamtags ruby:latest'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/test-flake Categorizes issue or PR as related to test flakes. priority/P2 sig/developer-experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants