From 175ca874e5cacc0a8770d03b5030e4eccec1dddf Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Nov 2024 16:32:01 -0600 Subject: [PATCH 1/3] Will BeforeSuite help? --- internal/api/tests/public/public_suite_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/api/tests/public/public_suite_test.go b/internal/api/tests/public/public_suite_test.go index eb09cdf5..7225d5c1 100644 --- a/internal/api/tests/public/public_suite_test.go +++ b/internal/api/tests/public/public_suite_test.go @@ -17,10 +17,20 @@ var ( func TestConfig(t *testing.T) { RegisterFailHandler(Fail) +/* cfg := config.Get() cfg.Set("web.port", 9002) api.WithApi(cfg) +*/ RunSpecs(t, "Public Controller Suite") } + + +var _ = BeforeSuite(func() { + cfg := config.Get() + cfg.Set("web.port", 9002) + + api.WithApi(cfg) +}) From fc4fc30f7b48232d874046c50fd0498a86aa2ca8 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Nov 2024 16:40:48 -0600 Subject: [PATCH 2/3] Will BeforeSuite help? --- internal/api/tests/public/public_suite_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/tests/public/public_suite_test.go b/internal/api/tests/public/public_suite_test.go index 7225d5c1..8b55f497 100644 --- a/internal/api/tests/public/public_suite_test.go +++ b/internal/api/tests/public/public_suite_test.go @@ -22,9 +22,9 @@ func TestConfig(t *testing.T) { cfg.Set("web.port", 9002) api.WithApi(cfg) -*/ RunSpecs(t, "Public Controller Suite") +*/ } From 5b2ab973ab647adbded9e4db19c849b57dfecaec Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Nov 2024 17:21:15 -0600 Subject: [PATCH 3/3] Test the test runs --- internal/api/tests/public/middleware_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/api/tests/public/middleware_test.go b/internal/api/tests/public/middleware_test.go index a8e78ee5..b3cb050a 100644 --- a/internal/api/tests/public/middleware_test.go +++ b/internal/api/tests/public/middleware_test.go @@ -23,7 +23,7 @@ var _ = Describe("Middleware", func() { req.Header.Add(requestIdHeader, requestId) res, err := test.Client.Do(req) - Expect(err).ToNot(HaveOccurred()) + Expect(err).To(HaveOccurred()) Expect(res.Header.Get(requestIdHeader)).To(Equal(requestId)) }) }) @@ -33,7 +33,7 @@ var _ = Describe("Middleware", func() { req, err := http.NewRequest(http.MethodGet, "http://localhost:9002/api/playbook-dispatcher/v1/openapi.json", nil) Expect(err).ToNot(HaveOccurred()) res, err := test.Client.Do(req) - Expect(err).ToNot(HaveOccurred()) + Expect(err).To(HaveOccurred()) Expect(res.StatusCode).To(Equal(http.StatusOK)) })