Move integration testing into a separate Docker image#123
Conversation
| WORKDIR /integration | ||
| # RUN npm install -g wait-on | ||
|
|
||
| ENTRYPOINT curl --retry 10 --retry-connrefused http://whyis > /dev/null && CYPRESS_baseUrl=http://whyis cypress run --spec cypress/integration/whyis/**/*; tar cf test-results-js.tar results |
There was a problem hiding this comment.
This should be a separate script. Also, prefer to use CMD (implied 'bash' entrypoint).
There was a problem hiding this comment.
The default entrypoint for the cypress/included image is cypress run, so this needed to be overridden to delay the tests.
There was a problem hiding this comment.
Makes sense. I would replace the ENTRYPOINT wish bash and then do your stuff in a CMD ./yourscript.sh
| @@ -0,0 +1,12 @@ | |||
| version: '3' | |||
| services: | |||
| whyis: | |||
There was a problem hiding this comment.
Should be called whyis-demo.
| @@ -1,3 +1,10 @@ | |||
| { | |||
| "baseUrl": "http://localhost:5000" | |||
| "baseUrl": "http://localhost:5000", | |||
There was a problem hiding this comment.
Create a custom cypress.json for CI and copy it in to the Cypress image (or put it in .circleci/) rather than replacing the tests/integration/cypress.json, which should be runnable locally by default and print to stdout.
There was a problem hiding this comment.
Even with the reporter options, Cypress will show the non-xml output, but I'll move the changes to a different file.
| # docker run --name whyis-demo $WHYIS_DEMO_IMAGE bash -c "mkdir -p /apps/whyis/test-results/js && curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y nodejs && cd /apps/whyis/tests/integration && npm install && CYPRESS_baseUrl=http://localhost npm run cypress:run-ci && tar cf test-results-js.tar results" | ||
|
|
||
| docker-compose -f docker/compose/testing/docker-compose.yml up --abort-on-container-exit | ||
| docker cp whyis-integration:/integration/test-results-js.tar test-results/js/ |
There was a problem hiding this comment.
Results probably aren't available yet, here. Need to loop until the file exists or some time has elapsed.
See e.g., the curl + sleep loops I've done before.
There was a problem hiding this comment.
I was under the impression that docker-compose should block until the tests are over, which by then, results should exist. tar doesn't seem to complain on CircleCI, so I thought the result tar should be there.
There was a problem hiding this comment.
No, I don't think that's the case. Tar generally doesn't complain if you pass it nothing.
No description provided.