Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions dropwizard-dedup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ Build without Keploy on the compile classpath:
mvn -B -DskipTests clean package
```

Build with the runtime Java agent copied into `target/keploy-sdk.jar`:
Build with the runtime Java agent (`io.keploy:keploy-sdk >= 2.3.0`, current release `2.4.0`) copied into `target/keploy-sdk.jar`:

```bash
mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package
mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean package
```

Run with the agent:
Run with only `keploy-sdk.jar` attached (`keploy-sdk.jar` bundles the JaCoCo runtime agent automatically; do not attach a separate `jacocoagent.jar`):

```bash
java \
-javaagent:target/keploy-sdk.jar \
-javaagent:target/jacocoagent.jar=destfile=/tmp/jacoco.exec \
-jar target/dropwizard-dedup.jar server config.yml
```
12 changes: 6 additions & 6 deletions java-dedup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ A Spring Boot application used by Keploy CI to validate Java dynamic deduplicati

CI does not record this sample. The `keploy/` directory is checked in so the pipeline only builds the app and runs replay with `--dedup --skip-app-restart`. When the sample behavior changes, record the fixtures locally and push the updated `keploy/` files.

The Keploy Java SDK is attached as a Java agent at replay time. The sample does not compile against `io.keploy:keploy-sdk` and does not import Keploy classes in application code.
The Keploy Java SDK (`io.keploy:keploy-sdk >= 2.3.0`, current release `2.4.0`) is attached as a Java agent at replay time. The sample does not compile against `io.keploy:keploy-sdk` and does not import Keploy classes in application code.

The SDK reads JaCoCo coverage in-process via `org.jacoco.agent.rt.RT.getAgent().getExecutionData(...)`, so attach both agents when running dynamic deduplication: the Keploy agent for the control/data socket protocol, and the JaCoCo agent for runtime coverage.
`keploy-sdk.jar` bundles the JaCoCo runtime agent and starts it automatically scoped to your application classes. Attach **only** `-javaagent:target/keploy-sdk.jar`; do **not** attach a separate `-javaagent:target/jacocoagent.jar` alongside it.

## Setup

```bash
mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package
mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean package
```

This builds the runnable application jar, copies `target/keploy-sdk.jar`, and copies `target/jacocoagent.jar` next to it.
This builds the runnable application jar and copies `target/keploy-sdk.jar` next to it.

## Run dedup natively

```bash
keploy test \
-c "java -javaagent:target/keploy-sdk.jar -javaagent:target/jacocoagent.jar -jar target/java-dedup.jar" \
-c "java -javaagent:target/keploy-sdk.jar -jar target/java-dedup.jar" \
--dedup --skip-app-restart --language java --delay 1 \
--health-url "http://127.0.0.1:8080/healthz" \
--health-poll-timeout 30s \
Expand All @@ -46,7 +46,7 @@ keploy dedup --path .
```

During `keploy test`, Enterprise rewrites the Compose file and injects its own shared `/tmp` volume for the dedup control/data sockets. The base sample Compose file does not need a host `/tmp` bind mount.
Re-run `docker compose build` whenever the jar, JaCoCo agent, or Dockerfile changes so replay uses the current image.
Re-run `docker compose build` whenever the jar, `keploy-sdk.jar`, or Dockerfile changes so replay uses the current image.

## Run dedup with direct Docker

Expand Down
12 changes: 7 additions & 5 deletions simple-java-dedup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@ The checked-in fixtures exercise `/healthz`, `/grade`, `/shipping`, `/inventory`

## Build

Requires `io.keploy:keploy-sdk` `>= 2.3.0` (current release: `2.4.0`). `keploy-sdk.jar` bundles the JaCoCo runtime agent automatically — attach only `-javaagent:target/keploy-sdk.jar` and do not attach a separate `jacocoagent.jar`.

```bash
mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package
mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean package
```

## Native Dedup

```bash
keploy test \
-c "java -javaagent:target/keploy-sdk.jar -javaagent:target/jacocoagent.jar -jar target/simple-java-dedup.jar" \
-c "java -javaagent:target/keploy-sdk.jar -jar target/simple-java-dedup.jar" \
--path . --dedup --language java --delay 1 \
--health-url "http://127.0.0.1:8080/healthz" \
--health-poll-timeout 30s \
--disableMockUpload --disableReportUpload

keploy dedup --path .
keploy dedup --path . --keep 1
```

## Docker Dedup
Expand All @@ -50,11 +52,11 @@ keploy test \
--health-poll-timeout 30s \
--disableMockUpload --disableReportUpload

keploy dedup --path .
keploy dedup --path . --keep 1
```

Keep the `-c` value as `docker compose up` so Keploy detects Docker Compose and mounts the shared `/tmp` socket volume used by Java dynamic deduplication. Pass `JAVA_VERSION`, `JAVA_DEDUP_IMAGE`, or port overrides in the shell environment instead of prefixing them inside the `-c` command.

## Expected Result

All 14 replayed fixtures should pass. Dedup should retain 10 test cases and mark 4 as duplicate, with exactly one duplicate from each intentional pair listed above.
All 14 replayed fixtures should pass. With `--keep 1`, dedup keeps 10 test cases and marks 4 as duplicates, one from each pair listed above. Without it, Keploy keeps up to 3 tests per group, so it marks none.
Loading