Skip to content

fix(node-dependency-matrix): count gRPC test cases in recording calibration (0 → 2)#101

Merged
charankamarapu merged 24 commits into
mainfrom
fix-grpc-testcase-calibration
Jul 2, 2026
Merged

fix(node-dependency-matrix): count gRPC test cases in recording calibration (0 → 2)#101
charankamarapu merged 24 commits into
mainfrom
fix-grpc-testcase-calibration

Conversation

@Shivanipandey31

Copy link
Copy Markdown
Contributor

Problem

The kube-regression suite (enterprise-ui, kube-flow.spec.ts test 8) asserts that the number of recorded test cases stays at or below a calibrated total read from this sample's fixtures/expected-values.json:

getExpectedTotalTestcases() = httpTrafficScript.expectedTestcasesExact
+ grpcTrafficScript.expectedAdditionalTestcasesExact
expectedAdditionalTestcasesExact was pinned at 0 because, at calibration time, k8s-proxy silently dropped gRPC test cases from the recording session — processTestCase only counted entries with a non-empty HTTPReq.URL, so the two gRPC calls in send_grpc_traffic.sh never incremented the recorded total. Observed gRPC contribution was genuinely 0.

k8s-proxy PR #542 now records gRPC test cases (recognizes GRPC_EXPORT, populates the endpoint list, increments TestsRecorded). With that change the recording produces 21 test cases (19 HTTP + 2 gRPC), tripping the assertion:

Error: Recorded test cases should not exceed the calibrated dedup total
Expected: <= 19
Received: 21
Fix

Bump grpcTrafficScript.expectedAdditionalTestcasesExact from 0 → 2, so the calibrated total becomes 19 + 2 = 21 and matches the recorded reality once gRPC cases are counted.

This just reconciles the aggregate with the per-call values already declared in the same file — both gRPC calls (Ping, RunDependencyScenario) already carry expectedAdditionalTestcases: 1.

🔄 Change
node-dependency-matrix/fixtures/expected-values.json: expectedAdditionalTestcasesExact 0 → 2 (1 line)
✅ Compatibility
The kube-regression assertion is a <= ceiling, so raising it is backward-compatible:

Released k8s-proxy (records 19): 19 <= 21 ✅
k8s-proxy PR #542 (records 21): 21 <= 21 ✅

officialasishkumar and others added 24 commits March 24, 2026 17:47
…n the node dependency matrix. Update documentation to reflect new features, including async workflows and enhanced deduplication for GET and POST requests. Adjust traffic recording scripts and improve error handling in the application logic.
…for better usability. Modify README and STAGING_RUNBOOK to clarify port-forwarding steps and add hints for using the hosted UI. Improve error handling in traffic recording scripts to guide users when using NodePorts.
…nd response structure. Update Kafka scenario to include cluster and topic details, and enhance generic scenario with better socket management and timeout handling.
…s. Introduced a new KIND_NODE_IMAGE variable to allow users to specify a custom image when creating the cluster, improving flexibility in deployment configurations.
- expectedTestcasesExact: 23 → 18 (post-dedup count, UI shows unique)
- expectedAdditionalTestcasesExact: 2 → 0 (gRPC not counted in UI total)
- Dedup entries: use path-only format without query params to match
  how the Static dedup section groups entries in the UI
- /dedup/catalog duplicateCount: 4 (all alpha+beta grouped)
- /dedup/order duplicateCount: 3 (all orders grouped)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The enterprise agent (v3.2.47) reliably captures Http, MySQL, PostgresV2,
and Redis mock kinds. Add PostgresV2 and Redis to requiredKinds so the
kube-regression tests assert all currently supported parsers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Route ERROR logs to stderr via console.error for proper log routing
- Cache CA bundle read to avoid blocking the event loop on repeated calls
- Ensure entrypoint.sh always creates the CA bundle file with a warning if no certs found
- Align @types/express version with express v4 runtime dependency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mock kinds captured by the sidecar are non-deterministic across runs
(depends on pod timing and sidecar readiness). Only Http is guaranteed
in every run. Other kinds are logged as informational via preferredKinds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
npm ci fails in CI because @types/express and related packages were
updated in package.json without regenerating the lock file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Docker Hub 429 rate limits cause Kind cluster deployment failures in
CI. Switch mysql, postgres, mongo, and redis images to
public.ecr.aws/docker/library/ mirrors which have no rate limits.

This matches the pattern used by api-server and enterprise-ui CI
pipelines (playwright-setup.sh).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
crictl pull goes directly to the registry (no cache), hitting rate
limits. docker pull uses the Docker daemon cache (restored from
MinIO by CI). kind load transfers cached images into the Kind
node's containerd without any registry access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both Docker Hub and ECR public are rate-limited. Configure Kind's
containerd to use mirror.gcr.io (Google's Docker Hub mirror) which
has no rate limits. Reverted ECR image references back to docker.io
since the GCR mirror handles them transparently inside Kind.

This matches the approach used by k8s-proxy CI (setup-cluster.sh).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All Keploy CI repos use a local Docker registry mirror at
192.168.116.165:5000 to avoid rate limits. Updated Kind containerd
config to use this mirror (primary) with mirror.gcr.io as fallback.

Matches the pattern in k8s-proxy/scripts/ci/setup-cluster.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kind load docker-image with multiple images fails entirely if one
image has issues. Load each image individually so failures are
isolated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
… 19 (#100)

The kube-regression dedup assertion (enterprise-ui kube-flow.spec.ts test 8)
checks the recorded test-case count against this contract value. It was
calibrated against the old keploy-agent (enterprise v3.2.74) the fixture chart
pinned; k8s-proxy now injects v3.5.44 (distroless + shell-free probes), which
records 19.

Verified this is correct, not a dedup regression: static dedup still collapses
every business duplicate exactly as the contract specifies
(GET /dedup/catalog 5->1, POST /dedup/order 4->1; all 16 business endpoints
recorded once). The recorded 19 = 16 deduped business endpoints + 3 non-business
probe/preflight buckets: GET /health (x1) and GET /expectations (x2 — its
request-header-name set differs between the curl preflight and the Playwright
readiness probe, and the agent's static-dedup key includes request-header
names). v3.2.74 recorded fewer only because it undercaptured that probe traffic
(an upstream OSS chunked/no-Content-Length capture bug since fixed).

Paired with enterprise-ui spec change (toBeLessThan -> toBeLessThanOrEqual) and
keploy/k8s-proxy#512 / keploy/enterprise-ui#1493.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
…ration

k8s-proxy now records gRPC test cases in the recording session (previously
dropped because processTestCase only counted entries with a non-empty
HTTPReq.URL). The two calls in send_grpc_traffic.sh (Ping,
RunDependencyScenario) each declare expectedAdditionalTestcases: 1, so the
aggregate must reflect them.

Bump grpcTrafficScript.expectedAdditionalTestcasesExact 0 -> 2 so
getExpectedTotalTestcases() settles at 19 (HTTP) + 2 (gRPC) = 21, matching
the recorded total once k8s-proxy counts gRPC cases. The kube-regression
assertion is a <= ceiling, so this stays backward-compatible with released
k8s-proxy (records 19; 19 <= 21).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 2, 2026 06:25

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

This PR introduces a new node-dependency-matrix TypeScript sample intended to exercise Keploy cloud record/replay across a wide set of inbound/outbound protocols and dependency integrations, and updates the repository index to reference it. It also updates the sample’s expectations contract to reflect that incoming gRPC calls now contribute 2 additional recorded testcases.

Changes:

  • Add the new node-dependency-matrix/ sample app (HTTP + gRPC servers) plus dependency runners for HTTPS, HTTP/2, gRPC, MySQL, Postgres, Mongo, Redis, Kafka, SQS, and a generic TLS socket.
  • Add operational tooling for running the sample locally and in Kind (Dockerfile, compose, Kubernetes manifests, deploy scripts, traffic scripts, runbooks).
  • Set fixtures/expected-values.json grpcTrafficScript.expectedAdditionalTestcasesExact to 2 to match the recorded gRPC testcase contribution.

Reviewed changes

Copilot reviewed 36 out of 41 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Adds the new sample to the repo’s top-level sample list.
node-dependency-matrix/.dockerignore Excludes local/dev-only paths from Docker build context.
node-dependency-matrix/.gitignore Ignores build output and generated artifacts for the new sample.
node-dependency-matrix/README.md Documents how to run/record traffic for the sample (Kind + Compose).
node-dependency-matrix/Dockerfile Builds and packages the sample for containerized deployments.
node-dependency-matrix/compose.yaml Provides a Docker Compose stack for local non-Kubernetes execution.
node-dependency-matrix/entrypoint.sh Builds a combined CA bundle at container startup for TLS egress.
node-dependency-matrix/fixtures/expected-values.json Encodes the machine-readable recording/replay contract and calibrated testcase totals.
node-dependency-matrix/k8s/README.md Documents the Kubernetes (Kind) deployment and hosted UI recording flow.
node-dependency-matrix/k8s/STAGING_RUNBOOK.md Detailed staging runbook and troubleshooting notes for hosted UI + k8s-proxy.
node-dependency-matrix/k8s/deploy-kind.sh Creates Kind cluster, builds/loads images, applies manifests, prints ingress hints.
node-dependency-matrix/k8s/kind-config.yaml Defines Kind port mappings for proxy/app HTTP/app gRPC.
node-dependency-matrix/k8s/port-forward.sh Port-forward helper for record-time traffic generation.
node-dependency-matrix/k8s/manifests/00-localstack.yaml Deploys LocalStack + init scripts for SQS.
node-dependency-matrix/k8s/manifests/01-mysql.yaml Deploys MySQL with mysql_native_password for recorder compatibility.
node-dependency-matrix/k8s/manifests/02-postgres.yaml Deploys Postgres for the Postgres dependency scenario.
node-dependency-matrix/k8s/manifests/03-mongo.yaml Deploys Mongo for the Mongo dependency scenario.
node-dependency-matrix/k8s/manifests/04-redis.yaml Deploys Redis for the Redis dependency scenario.
node-dependency-matrix/k8s/manifests/05-redpanda.yaml Deploys Redpanda for the Kafka dependency scenario.
node-dependency-matrix/k8s/manifests/06-fixture-service.yaml Deploys the TLS fixture service used by HTTPS/HTTP2/gRPC/generic scenarios.
node-dependency-matrix/k8s/manifests/07-tls-proxies.yaml Deploys TLS proxy sidecars for selected dependencies (mongo/redis/sqs/etc.).
node-dependency-matrix/k8s/manifests/08-app.yaml Deploys the main app service + deployment (HTTP + gRPC).
node-dependency-matrix/package.json Defines Node/TS build scripts and dependency set for the new sample.
node-dependency-matrix/proto/dependency_matrix.proto Defines gRPC services/methods used for inbound and fixture calls.
node-dependency-matrix/scripts/compose_up.sh Boots Compose stack and generates TLS certs.
node-dependency-matrix/scripts/compose_down.sh Stops Compose stack and removes volumes.
node-dependency-matrix/scripts/generate_certs.sh Generates a local CA + leaf certs with SANs for sample services.
node-dependency-matrix/scripts/localstack-init/01-create-queue.sh Creates the SQS queue inside LocalStack.
node-dependency-matrix/scripts/record_traffic.sh Sends HTTP traffic to exercise the recording scenarios.
node-dependency-matrix/scripts/send_grpc_traffic.sh Sends inbound gRPC traffic (Ping + scenario run) for recording.
node-dependency-matrix/src/global.d.ts Adds a minimal global crypto.randomUUID() type for TS compilation.
node-dependency-matrix/src/bin/app.ts Implements the HTTP API surface + gRPC server for scenario execution.
node-dependency-matrix/src/bin/dependencyFixture.ts Implements the fixture service endpoints (HTTPS/HTTP2/gRPC/generic TLS).
node-dependency-matrix/src/bin/tlsProxy.ts Implements a TLS proxy for dependencies that need TLS-wrapping.
node-dependency-matrix/src/lib/asyncJobs.ts Implements an async “catalog sync” background workflow for recording.
node-dependency-matrix/src/lib/config.ts Centralizes config/env parsing and fixtures/proto path resolution.
node-dependency-matrix/src/lib/dependencies.ts Implements outbound dependency scenarios (HTTP/2, DBs, queues, etc.).
node-dependency-matrix/src/lib/log.ts Adds a simple JSON logger used across the sample.
node-dependency-matrix/src/lib/proto.ts Loads the gRPC proto and defines client interfaces.
node-dependency-matrix/tsconfig.json TypeScript compiler configuration for the new sample.

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

Comment thread node-dependency-matrix/k8s/deploy-kind.sh
Comment thread node-dependency-matrix/entrypoint.sh
Comment thread node-dependency-matrix/src/lib/dependencies.ts
Comment thread node-dependency-matrix/fixtures/expected-values.json
@charankamarapu charankamarapu self-requested a review July 2, 2026 08:19

@charankamarapu charankamarapu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@charankamarapu charankamarapu merged commit e31c8a3 into main Jul 2, 2026
2 checks passed
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.

5 participants