-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
675 Add E2E Tests to CI without Mocking #676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of pros but has the downside that the runtime is longer. Find ways to utilized cache or stages.
raise AuthError({"message": msg}, 500) | ||
|
||
def health(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to its own controller because it is not a responsibility of an admin.
@@ -1,7 +1,7 @@ | |||
# TODO: Run the openapi_server with nginx as reverse proxy and gunicorn as WSGI server | |||
FROM python:3.10-alpine | |||
|
|||
RUN apk update && apk add build-base | |||
RUN apk update && apk add build-base && apk add curl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A shorter version: RUN apk --no-cache add build-base curl
will get the latest package index without caching it in the image and install the two packages.
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Push API Image | ||
run: | | ||
IMAGE_NAME=ghcr.io/hackforla/homeuniteus/api:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tags are going to cause problems with parallel builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Joshua-Douglas This is really cool! It looks like the majority of the added time comes from building the images, so I wonder if there's a way to speed that up. Also, wondering if we need to run all of these checks on every PR or if some can be situational. Thoughts?
I'm converting this to draft. I have some ideas on how to speed up the CI pipeline, but I'm going to implement #636 over these improvements. |
Closes #675.
What changes did you make?
app/cypress/e2e/create-new-password.cy.ts
. The test was short-circuiting the hostname config options.cryptography
to42.0.4
since41.0.7
has a known security vulnerabilitycryptography
is a transitive dependency of themoto
library. Unfortunately the most recent versions ofmoto
still use the outdated version so I had to elevatecrypography
to ourpyproject.toml
file.It is worth noting that our API container is being used as an API and a database. In the future we might consider breaking out the database into a separate container, and populating it with some test data. I'm leaving as-is for now since our db is relatively simple at this point.
Rationale behind the changes?
Testing done for these changes
test-api-real-aws
uses our real AWS service, and thattest-app-real-backend
uses the real backend. I verified both in d2e8836 by removing the AWS secret from the test config and remove the backend service from the CI pipeline. This change broke the "nomock" test suites, while the "mock" test suites continued to pass.What did you learn or can share that is new?(optional)
docker inspect
. It does this query to determine when the container is ready for use. If there is no HEALTHCHECK thendocker inspect
returns a0
exit code as soon as the container is initialized. A custom health check will ensure thatdocker inspect
does not return0
until the condition you define is met. In our case, the GH action should not progress until the API is actually available.Screenshots of Proposed Change
Here is the new CI pipeline flow: