Skip to content

Commit

Permalink
fix api server timeouts during shutdown
Browse files Browse the repository at this point in the history
Need to cancel the context. It is discussed in
kubernetes-sigs/controller-runtime#1571 (comment).
  • Loading branch information
jsanda committed Oct 18, 2021
1 parent 2aa917d commit 2f1f118
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion apis/config/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apis/k8ssandra/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apis/replication/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apis/stargate/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions controllers/k8ssandra/k8ssandracluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var (

func TestK8ssandraCluster(t *testing.T) {
ctx := testutils.TestSetup(t)
ctx, cancel := context.WithCancel(ctx)
testEnv = &testutils.MultiClusterTestEnv{}
seedsResolver.callback = func(dc *cassdcapi.CassandraDatacenter) ([]string, error) {
return []string{}, nil
Expand Down Expand Up @@ -82,6 +83,7 @@ func TestK8ssandraCluster(t *testing.T) {
}

defer testEnv.Stop(t)
defer cancel()

t.Run("CreateSingleDcCluster", testEnv.ControllerTest(ctx, createSingleDcCluster))
t.Run("CreateMultiDcCluster", testEnv.ControllerTest(ctx, createMultiDcCluster))
Expand Down
4 changes: 2 additions & 2 deletions controllers/replication/secret_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (

func TestSecretController(t *testing.T) {
ctx := testutils.TestSetup(t)
// ctx, cancel := context.WithCancel(ctx)
ctx, cancel := context.WithCancel(ctx)
testEnv = &testutils.MultiClusterTestEnv{}
err := testEnv.Start(ctx, t, func(mgr manager.Manager, clientCache *clientcache.ClientCache, clusters []cluster.Cluster) error {
return (&SecretSyncController{
Expand All @@ -51,7 +51,7 @@ func TestSecretController(t *testing.T) {
}

defer testEnv.Stop(t)
// defer cancel()
defer cancel()

// Secret controller tests
t.Run("SingleClusterDoNothingToSecretsTest", testEnv.ControllerTest(ctx, wrongClusterIgnoreCopy))
Expand Down
2 changes: 2 additions & 0 deletions controllers/stargate/stargate_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (

func TestStargate(t *testing.T) {
ctx := testutils.TestSetup(t)
ctx, cancel := context.WithCancel(ctx)
testEnv := &testutils.TestEnv{}
err := testEnv.Start(ctx, t, func(mgr manager.Manager) error {
err := (&StargateReconciler{
Expand All @@ -43,6 +44,7 @@ func TestStargate(t *testing.T) {
}

defer testEnv.Stop(t)
defer cancel()

t.Run("CreateStargateSingleRack", func(t *testing.T) {
testCreateStargateSingleRack(t, testEnv.TestClient)
Expand Down

0 comments on commit 2f1f118

Please sign in to comment.