Skip to content

Commit

Permalink
fix incorrect usage of log.IntoContext (#926)
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Ilario <filario@redhat.com>
Co-authored-by: Alexey Kazakov <alkazako@redhat.com>
  • Loading branch information
filariow and alexeykazakov authored Nov 9, 2023
1 parent 18d6497 commit 0c00045
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,7 @@ func TestCreateSynchronizeOrDeleteUserAccountFailed(t *testing.T) {
}

// when
ctx := context.Background()
log.IntoContext(ctx, testLog)
ctx := log.IntoContext(context.TODO(), testLog)
err := cntrl.wrapErrorWithStatusUpdate(ctx, mur, statusUpdater,
apierros.NewBadRequest("oopsy woopsy"), "failed to create %s", "user bob")

Expand Down
3 changes: 1 addition & 2 deletions controllers/masteruserrecord/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ func TestAlignReadiness(t *testing.T) {
}

l := zap.New(zap.UseDevMode(true))
ctx := context.TODO()
log.IntoContext(ctx, l)
ctx := log.IntoContext(context.TODO(), l)

t.Run("ready propagated and notification created", func(t *testing.T) {
// given
Expand Down
2 changes: 1 addition & 1 deletion controllers/space/space_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (r *Reconciler) ensureNSTemplateSet(ctx context.Context, space *toolchainv1
}

logger = logger.WithValues("target_member_cluster", space.Spec.TargetCluster)
log.IntoContext(ctx, logger)
ctx = log.IntoContext(ctx, logger)
// look-up the NSTemplateTier used by this Space
tmplTier := &toolchainv1alpha1.NSTemplateTier{}
if err := r.Client.Get(ctx, types.NamespacedName{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ func TestWrapErrorWithUpdateStatus(t *testing.T) {
members := NewGetMemberClusters(NewMemberClusterWithTenantRole(t, "member1", corev1.ConditionTrue), NewMemberClusterWithTenantRole(t, "member2", corev1.ConditionTrue))
controller := newController(t, hostCl, members)
logger := logf.Log.WithName("test")
ctx := context.Background()
log.IntoContext(ctx, logger)
ctx := log.IntoContext(context.TODO(), logger)

t.Run("no error provided", func(t *testing.T) {
statusUpdater := func(ctx context.Context, toolchainConfig *toolchainv1alpha1.ToolchainConfig, message string) error {
Expand Down

0 comments on commit 0c00045

Please sign in to comment.