-
Notifications
You must be signed in to change notification settings - Fork 0
feat(karate): #14: integrate and add e2e tests in karate #69
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
Open
aasheptunov
wants to merge
94
commits into
master
Choose a base branch
from
feature/#14-integrate-and-add-e2e-tests-in-karate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
fcf9748
chore(tests): #14: rename the 'test' directory to 'tests', since it w…
aasheptunov f114679
ci(tests): #14: add workflows for karate tests; remove of the build w…
aasheptunov 6e18899
ci(tests): #14: add a push event to the workflow so that the workflow…
aasheptunov 23639db
ci(workflows): #14: add the dockerfile required to run the workflow
aasheptunov 8b9855d
ci(tests): #14: add services for karate testing to docker compose
aasheptunov 08f07ae
Merge branch 'master' into feature/#14-integrate-and-add-e2e-tests-in…
aasheptunov 9f05bca
Merge branch 'master' into feature/#14-integrate-and-add-e2e-tests-in…
aasheptunov 0de63d0
ci(test): #14: return the test execution job within docker compose
aasheptunov 2881d8f
fix(tests): #14: correct the service name in the dependencies of the …
aasheptunov b052a6d
fix(tests): #14: remove of redundant environment variable definitions…
aasheptunov ec31200
fix(tests): #14: add a step to create and populate the .env file so t…
aasheptunov 278c16d
fix(tests): #14: commenting out a temporarily redundant file
aasheptunov accc8b9
feat(controllers): #14: change the logic for adding a new task by ret…
aasheptunov 6e864f1
test(e2e): #14: add a test that verifies the functionality for creati…
aasheptunov 94d3cd6
fix(tests): #14: correct the comments, otherwise the karate parser wo…
aasheptunov 70f6f0c
fix(tests): #14: correct the port value for the root path within the …
aasheptunov 21a4b4f
chore(git): #14: update the .gitignore file so that the .DS_Store Fin…
aasheptunov 0fafa61
chore(makefile): #14: updating the name of the run-tidy target to som…
aasheptunov 210436e
chore(devcontainer): #14: merging duplicate configurations
aasheptunov 5a456d7
chore(devcontainer): #14: add an environment variable containing the …
aasheptunov 574b7c3
chore(makefile): #14: add the targets up-db, ci-apply-migrations, and…
aasheptunov 7b137ca
ci(workflow): #14: replace native commands with Makefile targets so t…
aasheptunov a8fa243
test(tests): #14: add test cases for the other endpoints
aasheptunov 38d8a2f
feat(tests): #14: add pgAdmin to enable database viewing; add API sta…
aasheptunov 0eba13a
fix(dockerfile): #14: fix an error related to a path that does not in…
aasheptunov ab9514a
test(tests): #14: change the data type of a field referenced in a tes…
aasheptunov 312c730
ci(tests): #14: correct the repository link in the workflow so that t…
aasheptunov 0d4bef3
test(tests): #14: add the server response output to the test case for…
aasheptunov dd8d970
ci(tests): #14: update the branch for the to-dos-local-env repository…
aasheptunov d2b0eb9
chore(makefile): #14: change the condition for including the .env fil…
aasheptunov c007557
ci(workflows): #14: add a workflow trigger condition to a PR for debu…
aasheptunov 9dd4ae0
chore(dockerfile): #14: experiment with accepting migrations without …
aasheptunov ee367fe
fix(tests): #14: correct the name of the helmfile
aasheptunov e85a787
ci(tests): #14: modify the command being called to bypass the use of …
aasheptunov d4ec4e0
ci(tests): #14: add caching when building digests so that dependencie…
aasheptunov aea1677
ci(tests): #14: add dependency copying before the installation and bu…
aasheptunov 2e86af4
ci(tests): #14: add a debug message
aasheptunov 5f017eb
ci(tests): #14: add a debug message
aasheptunov 224aacb
ci(tests): #14: add a debug message
aasheptunov 0a473e7
ci(tests): #14: changes required to restart the workflow
aasheptunov 3281c43
ci(workflows): #14: add branch-based cache partitioning based on wher…
aasheptunov f8efa2e
docs: #14: add clarifying comments to the Dockerfile
aasheptunov 77331b7
ci(tests): #14: update the to-dos-local-env repository branch; update…
aasheptunov 11a8c80
ci(tests): #14: restore the workflow activation conditions on the PR
aasheptunov ea3c8a1
ci(workflows): #14: remove the debug call for image building from the PR
aasheptunov 606a8ad
fix(tests): #14: correct the parameter name, as the previous one did …
aasheptunov 3098d94
refactor(controllers): #14: remove the health check since it is redun…
aasheptunov 8c9219d
ci(tests): #14: add a makefile target to run karate tests inside dock…
aasheptunov 7369349
ci(workflows): #14: add a condition to trigger the workflow on a push…
aasheptunov dbb1c42
ci(tests): #14: remove the makefile target for karate tests, as using…
aasheptunov 2cff037
ci(workflows): #14: remove of the condition requiring the latest tag …
aasheptunov 9dda99c
ci(tests): #14: add image caching to the docker compose API to speed …
aasheptunov 0b102f7
ci(tests): #14: adda syntax version parameter to docker compose to al…
aasheptunov 1452dcb
ci(tests): #14: add a step to output the Docker Compose version
aasheptunov 1264aa2
ci(workflows): #14: add the `docker/setup-buildx-action@v3` installat…
aasheptunov 0f10448
ci(workflows): #14: change the caching method to gha for debugging
aasheptunov 6467d3f
fix(tests): #14: fix docker compose validation error
aasheptunov f7164d8
fix(tests): #14: remove the cache save step so that no error occurs w…
aasheptunov 6c07d7b
Merge branch 'master' into feature/#14-integrate-and-add-e2e-tests-in…
aasheptunov ee3728b
fix(controllers): #14: correctthe field name in the JSON returned by …
aasheptunov 41745a7
chore(tests): #14: change the location of the test directory; update …
aasheptunov 42ca394
fix(tests): #14: fix the issue with mounting the .conan2 directory du…
aasheptunov 34c24b8
ci(dockerfile): #14: removethe step to install make from the build st…
aasheptunov c21e384
fix(workflows): #14: change the host address when specifying the .env…
aasheptunov f2596ff
docs: remove of redundant comments
aasheptunov b7e6af9
ci(dockerfile): #14: add clarifying comments to the Dockerfile; remov…
aasheptunov 2a4541c
ci(dockerfile): #14: add clarifying comments to the Dockerfile; remov…
aasheptunov eba3911
ci(dockerignore): #14: add a dockerignore file so that files not requ…
aasheptunov 7b9398f
ci(dockerfile): #14: remove the redundant environment variable defini…
aasheptunov b725fbb
ci(dockerfile): #14: add additional paths to .dockerignore so that fi…
aasheptunov 7dc1b1c
ci(dockerfile): #14: remove unnecessary environment variable from the…
aasheptunov 61c5c85
ci(tests): #14: add a hash check for values in to-dos-api-cpp within …
aasheptunov 25671f0
ci(workflows): #14: add a command to update the commit sha for the in…
aasheptunov 932c28a
ci(workflows): #14: update the reference hash; add a clarifying comment
aasheptunov 9e0aae4
ci(workflows): #14: merge two stages into one so that all the prep wo…
aasheptunov 6d43ea1
docs: add clarifying comments
aasheptunov f880318
ci(workflows): #14: comment out the step to retrieve the version from…
aasheptunov e653493
docs(workflows): #14: add a comment to the GitHub workflow that clari…
aasheptunov ed9da39
refactor(app-config): #14: remove the default value from app-config t…
aasheptunov 96db180
chore(devcontainer): #14: add the forwardPorts and portsAttributes co…
aasheptunov bc728ce
docs(readme): #14: add an Allocated Ports & Services section to the R…
aasheptunov 39daf9d
feat(app-config): #14: add error messages for incorrectly defined env…
aasheptunov 6e0feef
fix(tests): #14: correct the name of the Makefile target as it had pr…
aasheptunov b6a59b6
refactor(tests): #14: remove the link to the branch in the to-dos-loc…
aasheptunov e0474c1
chore: #14: rename it to match the test
aasheptunov d2df268
ci: #14: merge the dependency loading layers in a single layer so as …
aasheptunov e8d96e9
feat: #14: add clarifying logs; add error handling; remove redundant …
aasheptunov 27e3c7d
test: #14: rename it to match the test
aasheptunov e572bc3
refactor: #14: formatting changes
aasheptunov 6b890d9
fix: #14: update database service credentials for to-dos-api-cpp serv…
aasheptunov 12a03c1
fix: #14: add character required for correct execution to conditions …
aasheptunov 9de6aa1
infra: #14: change to-dos-api-cpp helmfile hash to github repo action…
aasheptunov fa6e104
infra: #14: change condition for to-dos-api-cpp service in to-dos-api…
aasheptunov b00e44b
build: #14: remove redundant slash in curl parameter so that prevent …
aasheptunov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .github/ | ||
| .vscode/ | ||
| build/ | ||
| ci/ | ||
| scripts/ | ||
| e2e/ | ||
| docs/ | ||
| .clang-format | ||
| .clang-tidy | ||
| .env | ||
| .env.example | ||
| .gitattributes | ||
| .gitignore | ||
| CMakeUserPresets.json | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| pgAdmin.json | ||
| README.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: E2E Tests in PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| # this is needed to wait for the new docker image to be build and published to the registry | ||
| # so that we can use the image to run the service of the needed commit related version as part of local-env | ||
| # the idea is taken from here https://stackoverflow.com/a/71489231 | ||
| docker-build-and-push: | ||
| uses: ./.github/workflows/.reusable-docker-build-and-push.yml | ||
|
|
||
| e2e-test-against-local-env: | ||
| runs-on: ubuntu-24.04 | ||
| needs: [docker-build-and-push] | ||
| steps: | ||
| - name: Checkout local-env | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: TourmalineCore/to-dos-local-env | ||
|
|
||
| # we need to make sure that the values-to-dos-api-cpp.yaml.gotmpl file hasn't been modified | ||
| # in the `to-dos-local-env` repository, to ensure that the test runs as expected. | ||
| - name: Verify values file checksum | ||
| run: | | ||
| # the awk command is required to extract the target hash from the output of the sha256sum command | ||
| VALUES_HASH=$(sha256sum deploy/values-to-dos-api-cpp.yaml.gotmpl | awk '{ print $1 }') | ||
| if [ "$VALUES_HASH" != ${{ vars.TO_DOS_API_CPP_LOCAL_ENV_HELMFILE_HASH }} ]; then | ||
| echo "ERROR: checksum mismatch" | ||
| echo "Expected: 88d14f527d1c39d9af93ddbe2f41462f01b523bdc340b4c62cb72c31a4c46d1f" | ||
| echo "Actual: $VALUES_HASH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Deploy Local Env to Kind k8s | ||
| uses: devcontainers/ci@v0.3 | ||
| with: | ||
| runCmd: | | ||
| # we need to override "latest" image tag of ui inside local-env to run e2e against the current commit api version and not against latest from master | ||
| # We tried to use yq to change the image tag, but in the values files for helmfile we have non-yaml code that yq can`t parse or ignore | ||
| # so for that reason we use Stream EDitor which can find needed string using regular expressions and change it to a new value | ||
| # The -i flag is needed to write new image tag directly to values file | ||
| sed -i "0,/tag:.*/s//tag: \"sha-${{ github.event.pull_request.head.sha }}\"/" deploy/values-to-dos-api-cpp.yaml.gotmpl | ||
|
aasheptunov marked this conversation as resolved.
|
||
|
|
||
| # we also need to update the commit sha in the initContainer so that the latest image is used inside it | ||
| sed -i "0,/image:.*/s//image: \"ghcr.io/tourmalinecore/to-dos-api-cpp:sha-${{ github.event.pull_request.head.sha }}\"/" deploy/values-to-dos-api-cpp.yaml.gotmpl | ||
|
|
||
| # we need to override "latest" ref of service chart inside local-env to run tests against the current commit service chart version and not against latest from master | ||
| sed -i "0,/git+https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git?ref=.*/s//git+https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git?ref=${{ github.event.pull_request.head.sha }}/" deploy/helmfile.yaml.gotmpl | ||
|
|
||
| sed -i "0,/git::https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git@\/ci\/values.yaml?ref=.*/s//git::https:\/\/github.com\/TourmalineCore\/${{ github.event.repository.name }}.git@\/ci\/values.yaml?ref=${{ github.event.pull_request.head.sha }}/" deploy/helmfile.yaml.gotmpl | ||
|
|
||
| kind create cluster --name to-dos --config kind-local-config.yaml --kubeconfig ./.to-dos-cluster-kubeconfig | ||
| # we need to properly expose KUBECONFIG as an absolute path, pwd prints current working directory path | ||
| export KUBECONFIG=$(pwd)/.to-dos-cluster-kubeconfig | ||
|
|
||
| # When called, Makefile targets execute a sequence of commands. | ||
| # The targets are defined in the Makefile located in the root of the to-dos-local-env repository. | ||
| make deploy-with-cpp-api | ||
| push: never | ||
|
|
||
| - name: Check out the repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Download Karate JAR | ||
| run: | | ||
| curl -L https://github.com/karatelabs/karate/releases/download/v1.5.1/karate-1.5.1.jar -o karate.jar | ||
|
|
||
| - name: Run E2E Tests Against Local Env | ||
| run: | | ||
| java -jar karate.jar . | ||
| env: | ||
| "API_ROOT_URL": "http://localhost:30080/api/to-dos-api" | ||
|
|
||
| e2e-karate-tests-in-docker-compose: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout to repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # If you don't create a .env file, the services in Docker Compose | ||
| # won't be able to start because they use this file. | ||
| - name: Create .env file | ||
| run: | | ||
| echo "API_HOST=0.0.0.0" >> .env | ||
| echo "API_PORT=80" >> .env | ||
| echo "API_LOG_LEVEL=INFO" >> .env | ||
| echo "API_NUMBER_OF_THREADS=1" >> .env | ||
| echo "POSTGRES_HOST=0.0.0.0" >> .env | ||
| echo "POSTGRES_PORT=5432" >> .env | ||
| echo "POSTGRES_DB=to-dos-api-cpp-db" >> .env | ||
| echo "POSTGRES_USER=postgres" >> .env | ||
| echo "POSTGRES_PASSWORD=password" >> .env | ||
|
|
||
| - name: Run service via docker-compose and run Karate-tests | ||
| run: docker compose --profile MockForPullRequest up --exit-code-from to-dos-api-cpp-karate-tests | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.