Skip to content

Commit 2541e2b

Browse files
docs(restheart-mongo): document coverage overlay; drop list-routes/FIRED_ROUTES refs
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
1 parent 92ad161 commit 2541e2b

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

restheart-mongo/README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ The traffic loop exercises the surfaces that keploy parsers and matchers have to
2121

2222
```
2323
restheart-mongo/
24-
├── Dockerfile # FROM softinstigate/restheart:9.2.1
24+
├── Dockerfile # FROM softinstigate/restheart:9.2.1 (base; uninstrumented)
25+
├── Dockerfile.coverage # extends base, layers JaCoCo agent + cli for coverage
2526
├── docker-compose.yml # mongo:7 + restheart:9.2.1, fixed subnet, env-driven
26-
├── flow.sh # bootstrap | record-traffic | coverage | list-routes
27+
├── docker-compose.coverage.yml # overlay; arms JaCoCo via JAVA_TOOL_OPTIONS
28+
├── flow.sh # bootstrap | record-traffic | coverage
2729
├── keploy.yml.template # globalNoise for _etag/_oid/lastModified/Date
2830
└── README.md # this file
2931
```
@@ -33,20 +35,37 @@ restheart-mongo/
3335
The sample is keploy-independent: `docker compose up && bash flow.sh bootstrap && bash flow.sh record-traffic` runs end-to-end against bare RESTHeart. Lane scripts wrap that exact same path inside `keploy record` / `keploy test`.
3436

3537
* `bootstrap` — wait for RESTHeart to start serving and PUT the seed collections (`items`, `people`, `places`, `halpeople`, `relpeople`, `gql-apps`, `acl`, `_schemas`, `avatars.files`, `range_files.files`, `imported_csv`) so subsequent record-traffic calls have something to find.
36-
* `record-traffic` — drive the full RESTHeart REST surface listed above. Every call is logged to `${RESTHEART_FIRED_ROUTES_FILE}` (when set) so `coverage` has a numerator without a keploy recording, and every call is fault-tolerant (`|| true`) so a single transient 4xx never aborts the run. keploy is the assertion layer.
37-
* `coverage` — emits `(method, path)` coverage. The denominator is curated from RESTHeart's pattern-based mount table (see `restheart_list_routes` in `flow.sh`); RESTHeart routes are not file-system-derivable like Next.js, so the list lives in source and stays in lockstep with `record-traffic`.
38-
* `list-routes` — diagnostic; prints the route table the coverage report uses as its denominator.
38+
* `record-traffic` — drive the full RESTHeart REST surface listed above. Every call is fault-tolerant (`|| true`) so a single transient 4xx never aborts the run. keploy is the assertion layer.
39+
* `coverage` — emits real Java line coverage via JaCoCo when the `docker-compose.coverage.yml` overlay is applied; otherwise a no-op (the base image is uninstrumented so this prints an info message and exits 0).
3940

4041
## Local run
4142

43+
### Without keploy — smoke check
44+
4245
```sh
4346
docker compose up -d
4447
bash flow.sh bootstrap 240
45-
RESTHEART_FIRED_ROUTES_FILE=/tmp/fired.log bash flow.sh record-traffic
46-
RESTHEART_FIRED_ROUTES_FILE=/tmp/fired.log bash flow.sh coverage
48+
bash flow.sh record-traffic
4749
docker compose down -v
4850
```
4951

52+
This is what the keploy/enterprise compat lane wraps in `keploy record` / `keploy test` — the base compose is uninstrumented and runs unchanged inside that lane.
53+
54+
### Without keploy — measuring real Java line coverage
55+
56+
The base image is uninstrumented. Apply the coverage overlay to attach the JaCoCo agent:
57+
58+
```sh
59+
mkdir -p coverage
60+
docker compose -f docker-compose.yml -f docker-compose.coverage.yml up -d --build
61+
bash flow.sh bootstrap 240
62+
bash flow.sh record-traffic
63+
bash flow.sh coverage
64+
docker compose -f docker-compose.yml -f docker-compose.coverage.yml down -v
65+
```
66+
67+
The overlay (`Dockerfile.coverage` + `docker-compose.coverage.yml`) layers JaCoCo's agent + cli jars into the upstream restheart image and arms the agent at JVM start via `JAVA_TOOL_OPTIONS=-javaagent:...=output=tcpserver,...`. `flow.sh coverage` dumps execution data over the agent's TCP server (no JVM stop needed) and renders an XML line-coverage report. The overlay is consumed ONLY by the standalone GH Actions workflow — keploy/enterprise's compat lane ignores it and runs the base compose, paying zero JaCoCo cost (the agent rewrites bytecode at class-load and adds ~5-10% per-call overhead that would slow record/replay).
68+
5069
## Consumers
5170

5271
* `keploy/enterprise` `.woodpecker/restheart-linux.yml` — the RESTHeart compat lane delegates compose + traffic + coverage to this sample and wraps them in `keploy record` / `keploy test`.

0 commit comments

Comments
 (0)