Skip to content

Commit 64177ea

Browse files
ev-shindinclaude
andcommitted
Address review: make setup helpers private and add GinkgoHelper
- Rename SetupBenchmarkScenario → setupBenchmarkScenario (private) - Rename CaptureResultsAndGrafana → captureResultsAndGrafana (private) - Rename GatewayTargetURL → gatewayTargetURL (private) - Add GinkgoHelper() to setup/capture functions so failures report at the caller's line instead of inside the helper - Update doc comment to clarify fresh resource creation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3025016 commit 64177ea

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

test/benchmark/scale_up_latency_benchmark_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ var _ = Describe("Scale-Up Latency Benchmark", Label("benchmark"), Ordered, func
5757
)
5858

5959
BeforeAll(func() {
60-
SetupBenchmarkScenario(res)
60+
setupBenchmarkScenario(res)
6161
scenarioStart = time.Now()
6262
GinkgoWriter.Println("Benchmark scenario starting")
6363
})
6464

6565
AfterAll(func() {
66-
CaptureResultsAndGrafana(&results, scenarioStart)
66+
captureResultsAndGrafana(&results, scenarioStart)
6767
})
6868

6969
It("Phase 1: Baseline — establish baseline metrics", func() {
@@ -81,7 +81,7 @@ var _ = Describe("Scale-Up Latency Benchmark", Label("benchmark"), Ordered, func
8181

8282
spikeStart := time.Now()
8383

84-
targetURL := GatewayTargetURL()
84+
targetURL := gatewayTargetURL()
8585
GinkgoWriter.Printf("Load target URL (via Gateway): %s\n", targetURL)
8686

8787
By("Cleaning up any existing load jobs")

test/benchmark/setup_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ type ScenarioResources struct {
2727
JobBaseName string
2828
}
2929

30-
// SetupBenchmarkScenario creates the common infrastructure for a benchmark scenario:
30+
// setupBenchmarkScenario creates fresh benchmark infrastructure from scratch:
3131
// model service deployment, service, ServiceMonitor, VariantAutoscaling, and HPA.
3232
// It waits for the deployment to be ready, VA to stabilize, external metrics API to
3333
// serve wva_desired_replicas, and Prometheus to scrape simulator metrics.
3434
// Cleanup is registered via DeferCleanup.
35-
func SetupBenchmarkScenario(res ScenarioResources) {
35+
func setupBenchmarkScenario(res ScenarioResources) {
36+
GinkgoHelper()
3637
By("Creating model service deployment")
3738
err := fixtures.EnsureModelService(ctx, k8sClient, benchCfg.LLMDNamespace, res.ModelService, res.PoolName, benchCfg.ModelID, benchCfg.UseSimulator, benchCfg.MaxNumSeqs)
3839
Expect(err).NotTo(HaveOccurred(), "Failed to create model service")
@@ -131,9 +132,10 @@ func SetupBenchmarkScenario(res ScenarioResources) {
131132
GinkgoWriter.Println("Scenario setup completed — metrics pipeline verified")
132133
}
133134

134-
// CaptureResultsAndGrafana captures Grafana snapshots (if enabled) and writes benchmark
135+
// captureResultsAndGrafana captures Grafana snapshots (if enabled) and writes benchmark
135136
// results to the configured output file. Call this from AfterAll.
136-
func CaptureResultsAndGrafana(results *BenchmarkResults, scenarioStart time.Time) {
137+
func captureResultsAndGrafana(results *BenchmarkResults, scenarioStart time.Time) {
138+
GinkgoHelper()
137139
results.TotalDurationSec = time.Since(scenarioStart).Seconds()
138140

139141
if grafanaClient != nil && benchCfg.GrafanaEnabled {
@@ -183,8 +185,8 @@ func CaptureResultsAndGrafana(results *BenchmarkResults, scenarioStart time.Time
183185
GinkgoWriter.Printf("Results: %s\n", string(data))
184186
}
185187

186-
// GatewayTargetURL returns the full URL for load generation through the Gateway stack.
187-
func GatewayTargetURL() string {
188+
// gatewayTargetURL returns the full URL for load generation through the Gateway stack.
189+
func gatewayTargetURL() string {
188190
gwHost := fmt.Sprintf("%s.%s.svc.cluster.local", benchCfg.GatewayServiceName, benchCfg.LLMDNamespace)
189191
return fmt.Sprintf("http://%s:%d/v1/completions", gwHost, benchCfg.GatewayServicePort)
190192
}

0 commit comments

Comments
 (0)