Skip to content

feat: add mysql-crud sample for Enterprise self-hosted CI#145

Open
pathakharshit wants to merge 2 commits into
mainfrom
feat/add-mysql-crud-sample
Open

feat: add mysql-crud sample for Enterprise self-hosted CI#145
pathakharshit wants to merge 2 commits into
mainfrom
feat/add-mysql-crud-sample

Conversation

@pathakharshit

Copy link
Copy Markdown

Summary

Adds mysql-crud — a minimal Spring Boot + JDBC CRUD sample (users/orders, health, stats) backed by MySQL 8.

Why

keploy/enterprise's self-hosted cloud-replay E2E pipeline (keploy/enterprise#2200) needs a Java app that:

  • Uses a real jdbc:mysql://... datasource URL, to exercise the JDBC-specific secret-obfuscation code path (only triggered by the jdbc: prefix — distinct from generic MySQL wire-protocol handling)
  • Talks to a real MySQL 8 backend, to exercise object-storage mock upload/download for real recorded traffic

This app previously lived inline in the enterprise repo's .ci/ directory, which doesn't match this org's convention (samples belong here, referenced by pinned-commit git clone — see aerospike-e2e.yml's use of samples-go and java-linux.yml's use of spring-petclinic). Moving it here so enterprise's pipeline can clone it like every other sample-app dependency.

Endpoints

GET /health, GET /users, GET /users/{id}, POST /users, POST /users/{id}/orders, GET /stats

Notes

  • README documents the caching_sha2_password vs mysql_native_password MySQL 8 auth-plugin gotcha (Keploy's MySQL recorder can't parse the caching_sha2_password handshake) for anyone running this against their own MySQL container.
  • mvn clean package -DskipTests builds cleanly; verified locally.

Test plan

  • CI passes
  • keploy/enterprise#2200 clones this sample (pinned to this branch/commit until merge) and its E2E lane runs green

A minimal Spring Boot + JDBC CRUD app (users/orders, health, stats)
backed by MySQL 8, used by keploy/enterprise's self-hosted
cloud-replay E2E pipeline to exercise JDBC-manifest secret
obfuscation and object-storage mock upload/download against a real
database — not a mock or in-memory backend.

See keploy/enterprise#2200.
Copilot AI review requested due to automatic review settings July 1, 2026 10:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new mysql-crud sample application to this repository so Keploy Enterprise self-hosted CI can clone it as a pinned dependency and exercise JDBC-URL secret obfuscation plus MySQL 8 traffic recording/replay paths.

Changes:

  • Added a new Spring Boot 3 + JdbcTemplate CRUD sample with /health, /users, /users/{id}, /users/{id}/orders, and /stats endpoints.
  • Added MySQL initialization scripts (schema.sql, data.sql) and env-driven datasource configuration.
  • Added build/deploy assets for the sample (Maven pom.xml, Dockerfile, module README, .gitignore) and linked it from the repo root README.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Adds mysql-crud to the catalog of Java samples.
mysql-crud/src/main/resources/schema.sql Creates users, orders, and audit_log tables.
mysql-crud/src/main/resources/data.sql Seeds initial users and orders rows.
mysql-crud/src/main/resources/application.properties Env-driven MySQL JDBC config + SQL init + Hikari timeouts.
mysql-crud/src/main/java/com/keploy/sample/Application.java Spring Boot entrypoint for the new sample.
mysql-crud/src/main/java/com/keploy/sample/ApiController.java Implements the HTTP endpoints backed by JdbcTemplate.
mysql-crud/README.md Documents endpoints, configuration, MySQL auth-plugin note, and run instructions.
mysql-crud/pom.xml Declares Spring Boot Web/JDBC + MySQL connector dependencies and build output name.
mysql-crud/Dockerfile Multi-stage build to produce/run app.jar in a JRE base image.
mysql-crud/.gitignore Ignores Maven target/ and log files for the module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mysql-crud/src/main/java/com/keploy/sample/ApiController.java Outdated
Comment thread mysql-crud/src/main/java/com/keploy/sample/ApiController.java
@pathakharshit pathakharshit self-assigned this Jul 1, 2026
…ct orders for missing users

LAST_INSERT_ID() is connection-scoped; a pooled JdbcTemplate follow-up
call can land on a different physical connection than the INSERT and
return the wrong id (or null). Use KeyHolder to read the generated key
from the same statement/connection as the insert.

createOrder also inserted into orders even when the target user did
not exist, creating orphaned rows (no FK constraint) and a misleading
200 response. Now returns 404 before inserting.

Verified locally end-to-end against a real mysql:8.0 container:
createUser returns the correct row for its generated id, createOrder
returns the correct order for its generated id, and a 999 (nonexistent
user) orders request 404s with zero rows written.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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