Skip to content

test(benchmarks): cover the CurrentSpeedBenchmark performance gate#134

Merged
DemchaAV merged 1 commit into
developfrom
test/benchmarks-perf-gate
Jun 7, 2026
Merged

test(benchmarks): cover the CurrentSpeedBenchmark performance gate#134
DemchaAV merged 1 commit into
developfrom
test/benchmarks-perf-gate

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the missing test for CurrentSpeedBenchmark#evaluatePerformanceGate — the only benchmark check that actually fails a run. It enforces the smoke-profile absolute thresholds (avg latency + peak heap per scenario); previously it had zero coverage.

What's covered

CurrentSpeedBenchmarkPerfGateTest drives the gate with synthetic LatencyRow values, so the verdict is deterministic and machine-independent (the gate is not run against real measurements, which would be flaky):

  • passes when every scenario is within thresholds
  • fails on average-latency breach (message names the scenario)
  • fails on peak-heap breach
  • aggregates failures across multiple scenarios (and leaves passing ones out)
  • skips the gate for non-smoke profiles
  • ignores scenarios that have no configured threshold
  • honors the per-scenario graphcompose.benchmark.gate.<scenario>.maxAvgMillis override

Production change

Minimal test seam only — no behaviour change:

  • evaluatePerformanceGate -> static package-private (it uses no instance state)
  • LatencyRow, PerformanceGateResult, BenchmarkProfile -> package-private

so the same-package test can build inputs and read the verdict (same pattern as the existing BenchmarkDiffTool.ResolvedRunPair seam).

Verification

./mvnw -f benchmarks/pom.xml test -> 11/11 green (7 new perf-gate + 2 selection + 2 median); the new class runs in ~30 ms.

Note

Independent of #133 (different file: CurrentSpeedBenchmark vs BenchmarkDiffTool); both target develop and do not overlap.

evaluatePerformanceGate is the only benchmark check that actually fails a run (smoke-profile absolute thresholds on avg latency + peak heap), and it had no test. CurrentSpeedBenchmarkPerfGateTest drives it with synthetic LatencyRow values so the verdict is deterministic and machine-independent: pass within thresholds, fail on avg breach, fail on heap breach, multi-scenario failure aggregation, gate skipped for non-smoke profiles, scenarios without a threshold ignored, and the per-scenario system-property override honored.

evaluatePerformanceGate is now static package-private (no instance state) and LatencyRow / PerformanceGateResult / BenchmarkProfile are package-private so the same-package test can build inputs and assert the verdict.
@DemchaAV DemchaAV merged commit 4a9b1c7 into develop Jun 7, 2026
10 of 11 checks passed
@DemchaAV DemchaAV deleted the test/benchmarks-perf-gate branch June 7, 2026 12:12
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.

1 participant