-
Notifications
You must be signed in to change notification settings - Fork 64
Add spring-boot-product-catalog sample (Spring Boot + PostgreSQL) #149
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
dhananjay6561
wants to merge
4
commits into
main
Choose a base branch
from
spring-boot-product-catalog
base: main
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
4 commits
Select commit
Hold shift + click to select a range
ba9f299
Add spring-boot-product-catalog sample (Spring Boot + PostgreSQL)
dhananjay6561 e19f360
Align 404 message with the recorded contract
dhananjay6561 7aaa648
Address review: healthcheck, seed coverage, fail-loud readiness, atom…
dhananjay6561 f4f692c
Use Actuator readiness probe for the app healthcheck
dhananjay6561 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,81 @@ | ||
| # spring-boot-product-catalog sample CI — build + end-to-end smoke test. | ||
| # | ||
| # Scoped with `paths:` to this sample only, so unrelated samples don't pay for | ||
| # it (same convention as restheart-mongo.yml). Deliberately Keploy-independent: | ||
| # record/replay needs eBPF privileges that are awkward on hosted runners, so CI | ||
| # proves the app builds and serves the traffic the recorded suite was captured | ||
| # from. The committed test set under keploy/products-crud/ is the regression | ||
| # gate, exercised locally and in the Keploy pipelines. | ||
| name: spring-boot-product-catalog sample | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'spring-boot-product-catalog/**' | ||
| - '.github/workflows/spring-boot-product-catalog.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'spring-boot-product-catalog/**' | ||
| - '.github/workflows/spring-boot-product-catalog.yml' | ||
| workflow_dispatch: {} | ||
|
|
||
| concurrency: | ||
| group: spring-boot-product-catalog-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: build (JDK 21) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
| cache: maven | ||
|
|
||
| - name: Build with Maven | ||
| working-directory: spring-boot-product-catalog | ||
| run: ./mvnw -B -DskipTests clean package | ||
|
|
||
| smoke: | ||
| name: end-to-end smoke test | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Start app + Postgres | ||
| working-directory: spring-boot-product-catalog | ||
| run: docker compose up -d --build --wait | ||
|
|
||
| - name: Drive the recorded workload | ||
| working-directory: spring-boot-product-catalog | ||
| run: ./seed.sh | ||
|
|
||
| - name: Assert the catalog responds | ||
| working-directory: spring-boot-product-catalog | ||
| run: | | ||
| set -Eeuo pipefail | ||
| curl -fsS http://localhost:8080/api/products >/dev/null | ||
| curl -fsS http://localhost:8080/api/products/summary >/dev/null | ||
| # The 404 path must stay a clean 404, not a 500 — the recorded suite | ||
| # asserts the structured error body. | ||
| code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/products/99999) | ||
| [ "$code" = "404" ] || { echo "::error::expected 404 for a missing product, got $code"; exit 1; } | ||
| echo "OK — catalog, summary, and not-found paths all behave." | ||
|
|
||
| - name: Dump app logs on failure | ||
| if: failure() | ||
| working-directory: spring-boot-product-catalog | ||
| run: docker compose logs --no-color app | ||
|
|
||
| - name: Tear down | ||
| if: always() | ||
| working-directory: spring-boot-product-catalog | ||
| run: docker compose down -v |
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,6 @@ | ||
| target/ | ||
| keploy/ | ||
| .git/ | ||
| .idea/ | ||
| *.iml | ||
| HELP.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,2 @@ | ||
| /mvnw text eol=lf | ||
| *.cmd text eol=crlf |
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,37 @@ | ||
| target/ | ||
| .mvn/wrapper/maven-wrapper.jar | ||
| !**/src/main/**/target/ | ||
| !**/src/test/**/target/ | ||
|
|
||
| ### STS ### | ||
| .apt_generated | ||
| .classpath | ||
| .factorypath | ||
| .project | ||
| .settings | ||
| .springBeans | ||
| .sts4-cache | ||
|
|
||
| ### IntelliJ IDEA ### | ||
| .idea | ||
| *.iws | ||
| *.iml | ||
| *.ipr | ||
|
|
||
| ### NetBeans ### | ||
| /nbproject/private/ | ||
| /nbbuild/ | ||
| /dist/ | ||
| /nbdist/ | ||
| /.nb-gradle/ | ||
| build/ | ||
| !**/src/main/**/build/ | ||
| !**/src/test/**/build/ | ||
|
|
||
| ### VS Code ### | ||
| .vscode/ | ||
|
|
||
| # keploy runtime artifacts | ||
| agent-debug.log | ||
| **/agent-debug.log | ||
| docker-compose-tmp.yaml |
3 changes: 3 additions & 0 deletions
3
spring-boot-product-catalog/.mvn/wrapper/maven-wrapper.properties
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,3 @@ | ||
| wrapperVersion=3.3.4 | ||
| distributionType=only-script | ||
| distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip |
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,24 @@ | ||
| # syntax=docker/dockerfile:1 | ||
|
|
||
| # ---- Build stage: compile & package with a pinned JDK 21 (reproducible on any host) ---- | ||
| FROM eclipse-temurin:21-jdk AS build | ||
| WORKDIR /app | ||
|
|
||
| # Copy the Maven wrapper first so dependency resolution can be cached. | ||
| COPY .mvn/ .mvn/ | ||
| COPY mvnw pom.xml ./ | ||
| RUN ./mvnw -B -q dependency:go-offline | ||
|
|
||
| # Now copy sources and build the fat jar (skip tests — they need a live DB). | ||
| COPY src ./src | ||
| RUN ./mvnw -B -q -DskipTests clean package | ||
|
|
||
| # ---- Run stage: slim JRE image ---- | ||
| FROM eclipse-temurin:21-jre | ||
| WORKDIR /app | ||
| # curl is used by the docker-compose healthcheck. | ||
| RUN apt-get update && apt-get install -y --no-install-recommends curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| COPY --from=build /app/target/*.jar app.jar | ||
| EXPOSE 8080 | ||
| ENTRYPOINT ["java", "-jar", "app.jar"] | ||
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.