Skip to content

Commit 0a943f9

Browse files
nadiamoeRo Santalla
authored and
Ro Santalla
committed
k6runner: apply empty IP denylist even if it is empty
1 parent 95cf1a8 commit 0a943f9

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

internal/k6runner/k6runner.go

+1-9
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,14 @@ func New(opts RunnerOpts) Runner {
6060
r = &LocalRunner{
6161
k6path: opts.Uri,
6262
logger: &logger,
63+
blacklistedIP: opts.BlacklistedIP,
6364
fs: afero.NewOsFs(),
64-
blacklistedIP: "10.0.0.0/8",
6565
}
66-
67-
r.(*LocalRunner).withOpts(opts)
6866
}
6967

7068
return r
7169
}
7270

73-
func (r *LocalRunner) withOpts(opts RunnerOpts) {
74-
if opts.BlacklistedIP != "" {
75-
r.blacklistedIP = opts.BlacklistedIP
76-
}
77-
}
78-
7971
// Processor runs a script with a runner and parses the k6 output.
8072
type Processor struct {
8173
runner Runner

internal/k6runner/k6runner_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
func TestNew(t *testing.T) {
2626
r1 := New(RunnerOpts{Uri: "k6"})
2727
require.IsType(t, &LocalRunner{}, r1)
28-
require.Equal(t, "10.0.0.0/8", r1.(*LocalRunner).blacklistedIP)
28+
require.Equal(t, "", r1.(*LocalRunner).blacklistedIP)
2929
r2 := New(RunnerOpts{Uri: "/usr/bin/k6", BlacklistedIP: "192.168.4.0/24"})
3030
require.IsType(t, &LocalRunner{}, r2)
3131
require.Equal(t, "192.168.4.0/24", r2.(*LocalRunner).blacklistedIP)

0 commit comments

Comments
 (0)