diff --git a/internal/k6runner/k6runner.go b/internal/k6runner/k6runner.go index 4aa530ca..6a4bd686 100644 --- a/internal/k6runner/k6runner.go +++ b/internal/k6runner/k6runner.go @@ -57,7 +57,7 @@ func New(opts RunnerOpts) Runner { logger: &logger, } } else { - r = &LocalRunner{ + r = LocalRunner{ k6path: opts.Uri, logger: &logger, blacklistedIP: opts.BlacklistedIP, diff --git a/internal/k6runner/k6runner_test.go b/internal/k6runner/k6runner_test.go index fa3ea1a6..0bed670a 100644 --- a/internal/k6runner/k6runner_test.go +++ b/internal/k6runner/k6runner_test.go @@ -24,11 +24,13 @@ import ( func TestNew(t *testing.T) { r1 := New(RunnerOpts{Uri: "k6"}) - require.IsType(t, &LocalRunner{}, r1) - require.Equal(t, "", r1.(*LocalRunner).blacklistedIP) + require.IsType(t, LocalRunner{}, r1) + require.Equal(t, "", r1.(LocalRunner).blacklistedIP) + r2 := New(RunnerOpts{Uri: "/usr/bin/k6", BlacklistedIP: "192.168.4.0/24"}) - require.IsType(t, &LocalRunner{}, r2) - require.Equal(t, "192.168.4.0/24", r2.(*LocalRunner).blacklistedIP) + require.IsType(t, LocalRunner{}, r2) + require.Equal(t, "192.168.4.0/24", r2.(LocalRunner).blacklistedIP) + r3 := New(RunnerOpts{Uri: "http://localhost:6565"}) require.IsType(t, &HttpRunner{}, r3) r4 := New(RunnerOpts{Uri: "https://localhost:6565"})