-
Notifications
You must be signed in to change notification settings - Fork 0
feat: fully dockerized end to end tests #34
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
42db9dd
feat: full dockerized end to end tests
dotkas 545c33d
fix: added endpoint addition guard
dotkas 38a8a99
chore: pr comments
dotkas f1447a9
chore: use --locked
dotkas 93f6b00
chore: align workflow convention
dotkas 0072c18
chore: pr comments
dotkas da30863
chore: sniping in some copilot instructions changes
dotkas 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Keep the Docker build context small and platform-agnostic: never ship host | ||
| # build artifacts or VCS metadata into the image. | ||
| target/ | ||
| **/target/ | ||
| .git/ | ||
| .github/ | ||
| *.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: E2E | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| docker-e2e: | ||
| name: test | ||
| runs-on: ubuntu-latest | ||
| if: ${{ !startsWith(github.event.pull_request.title, 'chore:') }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Run Docker e2e (server + client over HTTP) | ||
| run: make test-e2e |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
| # Compile the generated blocking `reqwest` client and its e2e test, then run the | ||
| # test against the server named by BOOKSTORE_BASE_URL (set in docker-compose.yml). | ||
| # The image keeps the full toolchain because it runs `cargo test` at container | ||
| # start; pre-building with `--no-run` means startup goes straight to the tests. | ||
| # The build context is the repository root (see docker-compose.yml). | ||
|
|
||
| FROM rust:1.96-bookworm AS builder | ||
| WORKDIR /src | ||
| COPY . . | ||
| RUN cargo test --no-run --locked -p bookstore-example --features client --test e2e | ||
| CMD ["cargo", "test", "--locked", "-p", "bookstore-example", "--features", "client", "--test", "e2e", "--", "--nocapture"] |
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,29 @@ | ||
| name: bookstore-e2e | ||
|
|
||
| # End-to-end harness: the `server` service runs the generated axum server and the | ||
| # `client` service compiles the generated reqwest client + integration test and | ||
| # drives every bookstore endpoint over HTTP. Run from the repository root with: | ||
| # | ||
| # docker compose -f crates/oapi-codegen/tests/integration/docker-compose.yml \ | ||
| # up --build --exit-code-from client --abort-on-container-exit | ||
| # | ||
| # The overall exit status is the client's, so CI fails iff the e2e tests fail. | ||
|
|
||
| services: | ||
| server: | ||
| build: | ||
| context: ../../../.. | ||
| dockerfile: crates/oapi-codegen/tests/integration/server/Dockerfile | ||
| environment: | ||
| BOOKSTORE_ADDR: 0.0.0.0:8080 | ||
| expose: | ||
| - "8080" | ||
|
|
||
| client: | ||
| build: | ||
| context: ../../../.. | ||
| dockerfile: crates/oapi-codegen/tests/integration/client/Dockerfile | ||
| depends_on: | ||
| - server | ||
| environment: | ||
| BOOKSTORE_BASE_URL: http://server:8080 |
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,14 @@ | ||
| # Build the bookstore server binary from the workspace, then run it from a slim | ||
| # runtime image. The build context is the repository root (see docker-compose.yml). | ||
|
|
||
| FROM rust:1.96-bookworm AS builder | ||
| WORKDIR /src | ||
| COPY . . | ||
| RUN cargo build --release --locked -p bookstore-example --bin bookstore-server | ||
|
|
||
| FROM debian:bookworm-slim AS runtime | ||
| WORKDIR /app | ||
| COPY --from=builder /src/target/release/bookstore-server /usr/local/bin/bookstore-server | ||
| ENV BOOKSTORE_ADDR=0.0.0.0:8080 | ||
| EXPOSE 8080 | ||
| CMD ["bookstore-server"] |
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.
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.