Skip to content

Move integration testing into a separate Docker image#123

Merged
oxiez merged 15 commits into
masterfrom
integration_testing
Sep 13, 2019
Merged

Move integration testing into a separate Docker image#123
oxiez merged 15 commits into
masterfrom
integration_testing

Conversation

@oxiez

@oxiez oxiez commented Sep 12, 2019

Copy link
Copy Markdown
Collaborator

No description provided.

@oxiez oxiez requested a review from gordom6 September 12, 2019 14:22
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a separate script. Also, prefer to use CMD (implied 'bash' entrypoint).

@oxiez oxiez Sep 13, 2019

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default entrypoint for the cypress/included image is cypress run, so this needed to be overridden to delay the tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called whyis-demo.

@@ -1,3 +1,10 @@
{
"baseUrl": "http://localhost:5000"
"baseUrl": "http://localhost:5000",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think that's the case. Tar generally doesn't complain if you pass it nothing.

@oxiez oxiez merged commit 5a9d481 into master Sep 13, 2019
@pdwood pdwood deleted the integration_testing branch October 23, 2019 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants