Skip to content

Commit 4f4dd1d

Browse files
committed
use context.Background for server
1 parent 33c9b67 commit 4f4dd1d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

test/e2e/atlas_gov_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ var _ = Describe("Atlas for Government", Label("atlas-gov"), func() {
7979
)
8080
Expect(err).ToNot(HaveOccurred())
8181

82-
cancelCtx, cancel := context.WithCancel(ctx)
82+
// We don't want to inherit the SpecContext from the BeforeEach() ginkgo node
83+
// as otherwise the server will be shut down before starting AfterEach.
84+
// In fact we don't need anything else other than a context.Background() here.
85+
// The server will shut down as soon as the ginkgo process shuts down.
86+
cancelCtx, cancel := context.WithCancel(context.Background())
8387
managerStop = cancel
8488
go func() {
8589
err := managerStart(cancelCtx)

test/e2e/operator_type_wide_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ var _ = Describe("Deployment wide operator can work with resources in different
9393
FeatureFlags: featureflags.NewFeatureFlags(func() []string { return []string{} }),
9494
})
9595
Expect(err).NotTo(HaveOccurred())
96-
go func(ctx context.Context) context.Context {
97-
err := c.Start(ctx)
96+
go func() {
97+
// We don't want to inherit the SpecContext from the It() ginkgo node
98+
// as otherwise the server will be shut down before starting AfterEach.
99+
// In fact we don't need anything else other than a context.Background() here.
100+
// The server will shut down as soon as the ginkgo process shuts down.
101+
err := c.Start(context.Background())
98102
Expect(err).NotTo(HaveOccurred())
99-
return ctx
100-
}(ctx)
103+
}()
101104
})
102105

103106
By("Norton creates resources", func() {

0 commit comments

Comments
 (0)