Skip to content

Commit

Permalink
Fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanjana Lawande committed Jun 11, 2024
1 parent ad51756 commit a7248b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/operator/controllers/pullsecret/pullsecret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,22 @@ func (r *Reconciler) ensureGlobalPullSecret(ctx context.Context, operatorSecret,
// allows for simpler logic flow, when delete and create are not handled separately
// this call happens only when there is a need to change, it has no significant impact on performance
err := r.client.Delete(ctx, secret)
r.log.Info("Pullsecret Not Found, Creating Again")
r.log.Info("Global Pull secret Not Found, Creating Again")
if err != nil && !kerrors.IsNotFound(err) {
return nil, err
}

err = r.client.Create(ctx, secret)
r.log.Info("Pullsecret Created")
if err == nil {
r.log.Info("Global Pull secret Created")
}
return secret, err
}

err = r.client.Update(ctx, secret)
r.log.Info("Updating Existing Pullsecret")
if err == nil {
r.log.Info("Updating Existing Global Pull secret")
}
return secret, err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ func TestEnsureGlobalPullSecret(t *testing.T) {

r := &Reconciler{
client: clientBuilder.Build(),
log: logrus.NewEntry(logrus.StandardLogger()),
}

s, err := r.ensureGlobalPullSecret(ctx, tt.operatorPullSecret, tt.pullSecret)
Expand Down

0 comments on commit a7248b4

Please sign in to comment.