Skip to content

Commit 2fee7c5

Browse files
committed
Fix random port assignment logic
Assigning a random port used logic copied over from `fleet dump`, with magic numbers and values which did not quite apply to the benchmarking case.
1 parent 6f1069c commit 2fee7c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

benchmarks/record/record.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func getMetrics(res map[string]float64, name, namespace string, port int, contro
262262
Eventually(func(g Gomega) {
263263
// Note on the `nolint: gosec` comment below: We are looking for an available port number; this can afford to be
264264
// fairly predictable.
265-
hostPort = port + rand.IntN(57535) // Highest possible port: 65534
265+
hostPort = port + rand.IntN(65535-port) // TCP port range: 0-65535
266266

267267
cmd := exec.CommandContext(ctx, "kubectl", "-n", namespace, "port-forward", "service/"+name, fmt.Sprintf("%d:%d", hostPort, port))
268268

0 commit comments

Comments
 (0)