Skip to content

Commit

Permalink
remove which can ensure by chainsaw test setup
Browse files Browse the repository at this point in the history
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
  • Loading branch information
drivebyer committed Dec 22, 2024
1 parent 7370058 commit a856765
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 911 deletions.
10 changes: 5 additions & 5 deletions pkg/k8sutils/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func HandleRedisFinalizer(ctx context.Context, ctrlclient client.Client, cr *red
}
}
controllerutil.RemoveFinalizer(cr, RedisFinalizer)
if err := ctrlclient.Update(context.TODO(), cr); err != nil {
if err := ctrlclient.Update(ctx, cr); err != nil {

Check warning on line 34 in pkg/k8sutils/finalizer.go

View check run for this annotation

Codecov / codecov/patch

pkg/k8sutils/finalizer.go#L34

Added line #L34 was not covered by tests
log.FromContext(ctx).Error(err, "Could not remove finalizer", "finalizer", RedisFinalizer)
return err
}
Expand All @@ -50,7 +50,7 @@ func HandleRedisClusterFinalizer(ctx context.Context, ctrlclient client.Client,
}
}
controllerutil.RemoveFinalizer(cr, RedisClusterFinalizer)
if err := ctrlclient.Update(context.TODO(), cr); err != nil {
if err := ctrlclient.Update(ctx, cr); err != nil {

Check warning on line 53 in pkg/k8sutils/finalizer.go

View check run for this annotation

Codecov / codecov/patch

pkg/k8sutils/finalizer.go#L53

Added line #L53 was not covered by tests
log.FromContext(ctx).Error(err, "Could not remove finalizer "+RedisClusterFinalizer)
return err
}
Expand All @@ -69,7 +69,7 @@ func HandleRedisReplicationFinalizer(ctx context.Context, ctrlclient client.Clie
}
}
controllerutil.RemoveFinalizer(cr, RedisReplicationFinalizer)
if err := ctrlclient.Update(context.TODO(), cr); err != nil {
if err := ctrlclient.Update(ctx, cr); err != nil {

Check warning on line 72 in pkg/k8sutils/finalizer.go

View check run for this annotation

Codecov / codecov/patch

pkg/k8sutils/finalizer.go#L72

Added line #L72 was not covered by tests
log.FromContext(ctx).Error(err, "Could not remove finalizer "+RedisReplicationFinalizer)
return err
}
Expand All @@ -83,7 +83,7 @@ func HandleRedisSentinelFinalizer(ctx context.Context, ctrlclient client.Client,
if cr.GetDeletionTimestamp() != nil {
if controllerutil.ContainsFinalizer(cr, RedisSentinelFinalizer) {
controllerutil.RemoveFinalizer(cr, RedisSentinelFinalizer)
if err := ctrlclient.Update(context.TODO(), cr); err != nil {
if err := ctrlclient.Update(ctx, cr); err != nil {

Check warning on line 86 in pkg/k8sutils/finalizer.go

View check run for this annotation

Codecov / codecov/patch

pkg/k8sutils/finalizer.go#L86

Added line #L86 was not covered by tests
log.FromContext(ctx).Error(err, "Could not remove finalizer "+RedisSentinelFinalizer)
return err
}
Expand All @@ -96,7 +96,7 @@ func HandleRedisSentinelFinalizer(ctx context.Context, ctrlclient client.Client,
func AddFinalizer(ctx context.Context, cr client.Object, finalizer string, cl client.Client) error {
if !controllerutil.ContainsFinalizer(cr, finalizer) {
controllerutil.AddFinalizer(cr, finalizer)
return cl.Update(context.TODO(), cr)
return cl.Update(ctx, cr)

Check warning on line 99 in pkg/k8sutils/finalizer.go

View check run for this annotation

Codecov / codecov/patch

pkg/k8sutils/finalizer.go#L99

Added line #L99 was not covered by tests
}
return nil
}
Expand Down
Loading

0 comments on commit a856765

Please sign in to comment.