Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor remaining service and test code to remove references to old identity properties #399

Merged
merged 17 commits into from
Feb 6, 2024

Conversation

sbryzak
Copy link
Contributor

@sbryzak sbryzak commented Feb 4, 2024

This is an intermediate PR related to the following API PR:

codeready-toolchain/api#393

Since it only changes existing registration service code but doesn't actually update the API dependency it should be safe to merge independent of the other PRs referenced in the above API pull request.

Paired with codeready-toolchain/toolchain-e2e#892

@sbryzak
Copy link
Contributor Author

sbryzak commented Feb 4, 2024

/retest

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (545695d) 78.40% compared to head (5111800) 78.10%.

Files Patch % Lines
pkg/verification/service/verification_service.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #399      +/-   ##
==========================================
- Coverage   78.40%   78.10%   -0.31%     
==========================================
  Files          38       38              
  Lines        3306     3288      -18     
==========================================
- Hits         2592     2568      -24     
- Misses        620      624       +4     
- Partials       94       96       +2     
Flag Coverage Δ
unittests 78.10% <62.50%> (-0.31%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sbryzak
Copy link
Contributor Author

sbryzak commented Feb 4, 2024

/retest

Copy link

sonarqubecloud bot commented Feb 5, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

3 New issues
0 Security Hotspots
No data about Coverage
12.2% Duplication on New Code

See analysis details on SonarCloud

@@ -617,7 +585,7 @@ func (s *ServiceImpl) PhoneNumberAlreadyInUse(userID, username, phoneNumberOrHas
return errors.NewInternalError(err, "failed listing userSignups")
}
for _, signup := range userSignups {
if signup.Spec.Userid != userID && signup.Spec.Username != username && !states.Deactivated(signup) { // nolint:gosec
if signup.Spec.IdentityClaims.Sub != userID && signup.Spec.IdentityClaims.PreferredUsername != username && !states.Deactivated(signup) { // nolint:gosec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename the userID param to something like sub in the function signature in the line 574, so it's bit less confusing.

Suggested change
if signup.Spec.IdentityClaims.Sub != userID && signup.Spec.IdentityClaims.PreferredUsername != username && !states.Deactivated(signup) { // nolint:gosec
if signup.Spec.IdentityClaims.Sub != sub && signup.Spec.IdentityClaims.PreferredUsername != username && !states.Deactivated(signup) { // nolint:gosec

Copy link
Contributor

@alexeykazakov alexeykazakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one minor comment.

But could you please also create a PR for our sre repo to stop using the annotations in the usersignup. Basicaly the same PR as https://github.com/codeready-toolchain/sandbox-sre/pull/1406 but without the go dependency update. And we will need to get that PR merged right after this one so our banning CLI is still working.

Copy link

openshift-ci bot commented Feb 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, sbryzak

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [alexeykazakov,sbryzak]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sbryzak sbryzak merged commit b4a49ca into codeready-toolchain:master Feb 6, 2024
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants