From b98b61c2f441c6a25d50ff0bbdb53f7f1c6e9e2a Mon Sep 17 00:00:00 2001 From: Jaime Martinez Date: Tue, 8 Jun 2021 16:07:11 +1000 Subject: Use functional options for stub --- test/acceptance/helpers_test.go | 18 +++++++++----- test/acceptance/metrics_test.go | 5 +++- test/acceptance/serving_test.go | 40 ++++++++++++++++++------------ test/acceptance/stub_test.go | 54 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index 97387786..3c7a9d32 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -233,23 +233,29 @@ func RunPagesProcessWithOutput(t *testing.T, pagesBinary string, listeners []Lis return runPagesProcess(t, true, pagesBinary, listeners, promPort, nil, extraArgs...) } -func RunPagesProcessWithStubGitLabServer(t *testing.T, wait bool, pagesBinary string, listeners []ListenSpec, envs []string, extraArgs ...string) (*LogCaptureBuffer, func()) { +func RunPagesProcessWithStubGitLabServer(t *testing.T, opts ...processOption) (*LogCaptureBuffer, func()) { chdir := false chdirCleanup := testhelpers.ChdirInPath(t, "../../shared/pages", &chdir) wd, err := os.Getwd() require.NoError(t, err) - opts := &stubOpts{ - pagesRoot: wd, + processCfg := defaultProcessConfig + + for _, opt := range opts { + opt(&processCfg) + } + + if processCfg.gitlabStubOpts.pagesRoot == "" { + processCfg.gitlabStubOpts.pagesRoot = wd } - source := NewGitlabDomainsSourceStub(t, opts) + source := NewGitlabDomainsSourceStub(t, processCfg.gitlabStubOpts) gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t) - pagesArgs := append([]string{"-pages-root", wd, "-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab"}, extraArgs...) + processCfg.extraArgs = append(processCfg.extraArgs, "-pages-root", wd, "-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab") - logBuf, cleanup := runPagesProcess(t, wait, pagesBinary, listeners, "", envs, pagesArgs...) + logBuf, cleanup := runPagesProcess(t, processCfg.wait, processCfg.pagesBinary, listeners, "", processCfg.envs, processCfg.extraArgs...) return logBuf, func() { source.Close() diff --git a/test/acceptance/metrics_test.go b/test/acceptance/metrics_test.go index b1166bc7..56a80255 100644 --- a/test/acceptance/metrics_test.go +++ b/test/acceptance/metrics_test.go @@ -14,7 +14,10 @@ func TestPrometheusMetricsCanBeScraped(t *testing.T) { _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip") defer cleanup() - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}, "-max-conns=10", "-metrics-address=:42345") + _, teardown := RunPagesProcessWithStubGitLabServer(t, + withExtraArgument("max-conns", "10"), + withExtraArgument("metrics-address", ":42345"), + ) defer teardown() // need to call an actual resource to populate certain metrics e.g. gitlab_pages_domains_source_api_requests_total diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index ba0069b5..80aed7f8 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -16,7 +16,7 @@ import ( func TestUnknownHostReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() for _, spec := range supportedListeners() { @@ -31,7 +31,7 @@ func TestUnknownHostReturnsNotFound(t *testing.T) { func TestUnknownProjectReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, []ListenSpec{httpListener}, []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/nonexistent/") @@ -43,7 +43,7 @@ func TestUnknownProjectReturnsNotFound(t *testing.T) { func TestGroupDomainReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/") @@ -60,7 +60,7 @@ func TestGroupDomainReturns200(t *testing.T) { func TestKnownHostReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() tests := []struct { @@ -230,7 +230,7 @@ func TestCustom404(t *testing.T) { func TestCORSWhenDisabled(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}, "-disable-cross-origin-requests") + _, teardown := RunPagesProcessWithStubGitLabServer(t, withExtraArgument("disable-cross-origin-requests", "true")) defer teardown() for _, spec := range supportedListeners() { @@ -247,7 +247,7 @@ func TestCORSWhenDisabled(t *testing.T) { func TestCORSAllowsGET(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() for _, spec := range supportedListeners() { @@ -264,7 +264,7 @@ func TestCORSAllowsGET(t *testing.T) { func TestCORSForbidsPOST(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() for _, spec := range supportedListeners() { @@ -278,7 +278,11 @@ func TestCORSForbidsPOST(t *testing.T) { func TestCustomHeaders(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}, "-header", "X-Test1:Testing1", "-header", "X-Test2:Testing2") + + _, teardown := RunPagesProcessWithStubGitLabServer(t, + withExtraArgument("header", "X-Test1:Testing1"), + withExtraArgument("header", "X-Test2:Testing2"), + ) defer teardown() for _, spec := range supportedListeners() { @@ -293,7 +297,7 @@ func TestCustomHeaders(t *testing.T) { func TestKnownHostWithPortReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() for _, spec := range supportedListeners() { @@ -308,7 +312,7 @@ func TestKnownHostWithPortReturns200(t *testing.T) { func TestHttpToHttpsRedirectDisabled(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") @@ -325,7 +329,7 @@ func TestHttpToHttpsRedirectDisabled(t *testing.T) { func TestHttpToHttpsRedirectEnabled(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}, "-redirect-http=true") + _, teardown := RunPagesProcessWithStubGitLabServer(t, withExtraArgument("redirect-http", "true")) defer teardown() rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") @@ -587,7 +591,7 @@ func TestGitLabSourceBecomesUnauthorized(t *testing.T) { func TestKnownHostInReverseProxySetupReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, []ListenSpec{proxyListener}, []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() rsp, err := GetProxiedPageFromListener(t, proxyListener, "localhost", "group.gitlab-example.com", "project/") @@ -694,7 +698,7 @@ func doCrossOriginRequest(t *testing.T, spec ListenSpec, method, reqMethod, url func TestQueryStringPersistedInSlashRewrite(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, supportedListeners(), []string{}) + _, teardown := RunPagesProcessWithStubGitLabServer(t) defer teardown() rsp, err := GetRedirectPage(t, httpsListener, "group.gitlab-example.com", "project?q=test") @@ -731,7 +735,11 @@ func TestServerRepliesWithHeaders(t *testing.T) { for name, test := range tests { testFn := func(envArgs, headerArgs []string) func(*testing.T) { return func(t *testing.T) { - _, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, []ListenSpec{httpListener}, envArgs, headerArgs...) + _, teardown := RunPagesProcessWithStubGitLabServer(t, + withListeners([]ListenSpec{httpListener}), + withEnv(envArgs), + withArguments(headerArgs), + ) defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/") @@ -777,7 +785,9 @@ func TestServerRepliesWithHeaders(t *testing.T) { func TestDiskDisabledFailsToServeFileAndLocalContent(t *testing.T) { skipUnlessEnabled(t) - logBuf, teardown := RunPagesProcessWithStubGitLabServer(t, true, *pagesBinary, []ListenSpec{httpListener}, nil, "-enable-disk=false") + logBuf, teardown := RunPagesProcessWithStubGitLabServer(t, + withExtraArgument("enable-disk", "false"), + ) defer teardown() for host, suffix := range map[string]string{ diff --git a/test/acceptance/stub_test.go b/test/acceptance/stub_test.go index 8f52ec37..e4dfbff7 100644 --- a/test/acceptance/stub_test.go +++ b/test/acceptance/stub_test.go @@ -12,6 +12,60 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/fixture" ) +var defaultProcessConfig = processConfig{ + wait: true, + pagesBinary: *pagesBinary, + listeners: supportedListeners(), + envs: []string{}, + extraArgs: []string{}, + gitlabStubOpts: &stubOpts{}, +} + +type processConfig struct { + wait bool + pagesBinary string + listeners []ListenSpec + envs []string + extraArgs []string + gitlabStubOpts *stubOpts +} + +type processOption func(*processConfig) + +func withWait(v bool) processOption { + return func(config *processConfig) { + config.wait = v + } +} +func withListeners(listeners []ListenSpec) processOption { + return func(config *processConfig) { + config.listeners = listeners + } +} + +func withEnv(envs []string) processOption { + return func(config *processConfig) { + config.envs = envs + } +} + +func withExtraArgument(key, value string) processOption { + return func(config *processConfig) { + config.extraArgs = append(config.extraArgs, fmt.Sprintf("-%s=%s", key, value)) + } +} +func withArguments(args []string) processOption { + return func(config *processConfig) { + config.extraArgs = args + } +} + +func withGitlabStubOpts(opts *stubOpts) processOption { + return func(config *processConfig) { + config.gitlabStubOpts = opts + } +} + // makeGitLabPagesAccessStub provides a stub *httptest.Server to check pages_access API call. // the result is based on the project id. // -- cgit v1.2.3 From 296105df9f56d10eb7ab1f4b716b2d8d35fdea8d Mon Sep 17 00:00:00 2001 From: Jaime Martinez Date: Tue, 8 Jun 2021 16:18:04 +1000 Subject: Fix lint violations --- test/acceptance/stub_test.go | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'test') diff --git a/test/acceptance/stub_test.go b/test/acceptance/stub_test.go index e4dfbff7..3326b49e 100644 --- a/test/acceptance/stub_test.go +++ b/test/acceptance/stub_test.go @@ -32,11 +32,6 @@ type processConfig struct { type processOption func(*processConfig) -func withWait(v bool) processOption { - return func(config *processConfig) { - config.wait = v - } -} func withListeners(listeners []ListenSpec) processOption { return func(config *processConfig) { config.listeners = listeners @@ -60,12 +55,6 @@ func withArguments(args []string) processOption { } } -func withGitlabStubOpts(opts *stubOpts) processOption { - return func(config *processConfig) { - config.gitlabStubOpts = opts - } -} - // makeGitLabPagesAccessStub provides a stub *httptest.Server to check pages_access API call. // the result is based on the project id. // -- cgit v1.2.3 From 7f676903538f06b73d83ce03e6bc1ab0db89a934 Mon Sep 17 00:00:00 2001 From: Jaime Martinez Date: Wed, 9 Jun 2021 14:48:56 +1000 Subject: Use t.Cleanup --- test/acceptance/helpers_test.go | 8 +++++--- test/acceptance/metrics_test.go | 3 +-- test/acceptance/serving_test.go | 45 ++++++++++++++--------------------------- 3 files changed, 21 insertions(+), 35 deletions(-) (limited to 'test') diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index 3c7a9d32..ec712b6d 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -233,7 +233,7 @@ func RunPagesProcessWithOutput(t *testing.T, pagesBinary string, listeners []Lis return runPagesProcess(t, true, pagesBinary, listeners, promPort, nil, extraArgs...) } -func RunPagesProcessWithStubGitLabServer(t *testing.T, opts ...processOption) (*LogCaptureBuffer, func()) { +func RunPagesProcessWithStubGitLabServer(t *testing.T, opts ...processOption) *LogCaptureBuffer { chdir := false chdirCleanup := testhelpers.ChdirInPath(t, "../../shared/pages", &chdir) @@ -257,11 +257,13 @@ func RunPagesProcessWithStubGitLabServer(t *testing.T, opts ...processOption) (* logBuf, cleanup := runPagesProcess(t, processCfg.wait, processCfg.pagesBinary, listeners, "", processCfg.envs, processCfg.extraArgs...) - return logBuf, func() { + t.Cleanup(func() { source.Close() chdirCleanup() cleanup() - } + }) + + return logBuf } func RunPagesProcessWithAuth(t *testing.T, pagesBinary string, listeners []ListenSpec, promPort string) func() { diff --git a/test/acceptance/metrics_test.go b/test/acceptance/metrics_test.go index 56a80255..6ba147aa 100644 --- a/test/acceptance/metrics_test.go +++ b/test/acceptance/metrics_test.go @@ -14,11 +14,10 @@ func TestPrometheusMetricsCanBeScraped(t *testing.T) { _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip") defer cleanup() - _, teardown := RunPagesProcessWithStubGitLabServer(t, + RunPagesProcessWithStubGitLabServer(t, withExtraArgument("max-conns", "10"), withExtraArgument("metrics-address", ":42345"), ) - defer teardown() // need to call an actual resource to populate certain metrics e.g. gitlab_pages_domains_source_api_requests_total res, err := GetPageFromListener(t, httpListener, "zip.gitlab.io", diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index 80aed7f8..92727d28 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -16,8 +16,7 @@ import ( func TestUnknownHostReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { rsp, err := GetPageFromListener(t, spec, "invalid.invalid", "") @@ -31,8 +30,7 @@ func TestUnknownHostReturnsNotFound(t *testing.T) { func TestUnknownProjectReturnsNotFound(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/nonexistent/") require.NoError(t, err) @@ -43,8 +41,7 @@ func TestUnknownProjectReturnsNotFound(t *testing.T) { func TestGroupDomainReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/") require.NoError(t, err) @@ -60,8 +57,7 @@ func TestGroupDomainReturns200(t *testing.T) { func TestKnownHostReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) tests := []struct { name string @@ -230,8 +226,7 @@ func TestCustom404(t *testing.T) { func TestCORSWhenDisabled(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, withExtraArgument("disable-cross-origin-requests", "true")) - defer teardown() + RunPagesProcessWithStubGitLabServer(t, withExtraArgument("disable-cross-origin-requests", "true")) for _, spec := range supportedListeners() { for _, method := range []string{"GET", "OPTIONS"} { @@ -247,8 +242,7 @@ func TestCORSWhenDisabled(t *testing.T) { func TestCORSAllowsGET(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { for _, method := range []string{"GET", "OPTIONS"} { @@ -264,8 +258,7 @@ func TestCORSAllowsGET(t *testing.T) { func TestCORSForbidsPOST(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { rsp := doCrossOriginRequest(t, spec, "OPTIONS", "POST", spec.URL("project/")) @@ -279,11 +272,10 @@ func TestCORSForbidsPOST(t *testing.T) { func TestCustomHeaders(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, + RunPagesProcessWithStubGitLabServer(t, withExtraArgument("header", "X-Test1:Testing1"), withExtraArgument("header", "X-Test2:Testing2"), ) - defer teardown() for _, spec := range supportedListeners() { rsp, err := GetPageFromListener(t, spec, "group.gitlab-example.com:", "project/") @@ -297,8 +289,7 @@ func TestCustomHeaders(t *testing.T) { func TestKnownHostWithPortReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) for _, spec := range supportedListeners() { rsp, err := GetPageFromListener(t, spec, "group.gitlab-example.com:"+spec.Port, "project/") @@ -312,8 +303,7 @@ func TestKnownHostWithPortReturns200(t *testing.T) { func TestHttpToHttpsRedirectDisabled(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") require.NoError(t, err) @@ -329,8 +319,7 @@ func TestHttpToHttpsRedirectDisabled(t *testing.T) { func TestHttpToHttpsRedirectEnabled(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t, withExtraArgument("redirect-http", "true")) - defer teardown() + RunPagesProcessWithStubGitLabServer(t, withExtraArgument("redirect-http", "true")) rsp, err := GetRedirectPage(t, httpListener, "group.gitlab-example.com", "project/") require.NoError(t, err) @@ -591,8 +580,7 @@ func TestGitLabSourceBecomesUnauthorized(t *testing.T) { func TestKnownHostInReverseProxySetupReturns200(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) rsp, err := GetProxiedPageFromListener(t, proxyListener, "localhost", "group.gitlab-example.com", "project/") @@ -698,8 +686,7 @@ func doCrossOriginRequest(t *testing.T, spec ListenSpec, method, reqMethod, url func TestQueryStringPersistedInSlashRewrite(t *testing.T) { skipUnlessEnabled(t) - _, teardown := RunPagesProcessWithStubGitLabServer(t) - defer teardown() + RunPagesProcessWithStubGitLabServer(t) rsp, err := GetRedirectPage(t, httpsListener, "group.gitlab-example.com", "project?q=test") require.NoError(t, err) @@ -735,12 +722,11 @@ func TestServerRepliesWithHeaders(t *testing.T) { for name, test := range tests { testFn := func(envArgs, headerArgs []string) func(*testing.T) { return func(t *testing.T) { - _, teardown := RunPagesProcessWithStubGitLabServer(t, + RunPagesProcessWithStubGitLabServer(t, withListeners([]ListenSpec{httpListener}), withEnv(envArgs), withArguments(headerArgs), ) - defer teardown() rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "/") require.NoError(t, err) @@ -785,10 +771,9 @@ func TestServerRepliesWithHeaders(t *testing.T) { func TestDiskDisabledFailsToServeFileAndLocalContent(t *testing.T) { skipUnlessEnabled(t) - logBuf, teardown := RunPagesProcessWithStubGitLabServer(t, + logBuf := RunPagesProcessWithStubGitLabServer(t, withExtraArgument("enable-disk", "false"), ) - defer teardown() for host, suffix := range map[string]string{ // API serves "source": { "type": "local" } -- cgit v1.2.3 From e81437ddaff9fdbb8221b10a8c053634867e80bc Mon Sep 17 00:00:00 2001 From: Jaime Martinez Date: Thu, 10 Jun 2021 11:19:43 +1000 Subject: Append arguments instead --- test/acceptance/stub_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/acceptance/stub_test.go b/test/acceptance/stub_test.go index 3326b49e..2ba7da41 100644 --- a/test/acceptance/stub_test.go +++ b/test/acceptance/stub_test.go @@ -40,7 +40,7 @@ func withListeners(listeners []ListenSpec) processOption { func withEnv(envs []string) processOption { return func(config *processConfig) { - config.envs = envs + config.envs = append(config.envs, envs...) } } @@ -51,7 +51,7 @@ func withExtraArgument(key, value string) processOption { } func withArguments(args []string) processOption { return func(config *processConfig) { - config.extraArgs = args + config.extraArgs = append(config.extraArgs, args...) } } -- cgit v1.2.3