Commit df4ad47
fix(restheart-mongo): deterministic GraphQL app cache + expires_in noise (#142)
* fix(restheart-mongo): deterministic GraphQL app cache + expires_in noise
The keploy restheart-mongo lane flaked on two recorded fields; both are
app/JWT non-determinism, fixed the same way the lane already handles the
ACL cache and the access_token JWT:
1. post-graphql-halpeople (mongo mock-miss -> 500 MongoSocketReadException):
RESTHeart's GraphQL service caches gql-apps app definitions with a 60s
time-to-revalidate (app-cache-ttr, Caffeine nanoTime ticker) — the exact
same time-freeze x cache-ttl interaction already documented for
/mongoAclAuthorizer. Under `keploy test --freezeTime` the ticker is
frozen, so the app cache never revalidates and RESTHeart issues a
different number/order of `find gql-apps` mongo queries than were
recorded; the unmatched find has no mock so keploy's mongo proxy closes
the socket and RESTHeart returns 500 instead of the recorded response.
Fix: add /graphql/app-cache-enabled->false to RHO so gql-apps is
read-through every request (identical mongo stream at record & replay),
mirroring the existing /mongoAclAuthorizer/cache-enabled->false.
2. post-token (expires_in 872 vs 871): /tokens returns expires_in =
seconds-until-exp computed at request time; it can differ by 1s across
record/replay when the request straddles a second boundary, even under
--freezeTime. The JWT itself (access_token) is already noised; add
expires_in to globalNoise.body for the same reason.
Signed-off-by: Shubham Jain <shubham@keploy.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: slayerjain <shubham@keploy.io>
* fix(restheart-mongo): disable frozen /mongo metadata caches for deterministic replay
RESTHeart's /mongo local-cache (db/collection _properties, 60s ttl) and
schema-cache (JSON schemas, 60s ttl) are Caffeine caches ticking on
System.nanoTime(), which --freezeTime freezes. The frozen ttl shifts which
per-test window each 'find _properties' mongo query lands in between record and
replay, so keploy's strict per-test mock pool misses -> mongo socket close ->
500 MongoSocketReadException. Observed on keploy/enterprise pipeline 5867
(record-pr-replay-stable): 13/306 flaked on get-root/post-users/delete-* legs
that COMPAT_TEST_RETRIES could not absorb.
Same frozen-ticker class as the ACL and GraphQL cache disables already in this
file; makes _properties/schema reads read-through (deterministic, always
correct, small perf cost). get-collection-cache left enabled (inert: needs
?cache, which flow.sh never sends).
Signed-off-by: slayerjain <shubhamkjain@outlook.com>
---------
Signed-off-by: Shubham Jain <shubham@keploy.io>
Signed-off-by: slayerjain <shubham@keploy.io>
Signed-off-by: slayerjain <shubhamkjain@outlook.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6645b0d commit df4ad47
2 files changed
Lines changed: 52 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
62 | 106 | | |
63 | 107 | | |
64 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments