Skip to content

drop service factory and service context abstractions #506

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

Merged

Conversation

MatousJobanek
Copy link
Contributor

KUBESAW-260

Finally first bigger removal at the service abstraction level. This PR drops:

  • UserSignup options
  • Service factory
  • Service context

and simplifies the creation of the services.
The PR also contains some necessary fixes in unit tests.

Copy link

Comment on lines -258 to 270
s.Run("init verification success phone number with parenthesis and spaces", func() {
assertInitVerificationSuccess("(226) 821 3045", "9691252ac0ea2cb55295ac9b98df1c51", 2)
})
assertInitVerificationSuccess(handler, fakeClient, "2268213044", "fd276563a8232d16620da8ec85d0575f", 1)

s.Run("init verification success phone number with dashes", func() {
assertInitVerificationSuccess("226-821-3044", "fd276563a8232d16620da8ec85d0575f", 3)
})
s.Run("init verification success phone number with spaces", func() {
assertInitVerificationSuccess("2 2 6 8 2 1 3 0 4 7", "ce3e697125f35efb76357ed8e3b768b7", 4)
s.Run("init verification success phone number with parenthesis and spaces", func() {
assertInitVerificationSuccess(handler, fakeClient, "(226) 821 3045", "9691252ac0ea2cb55295ac9b98df1c51", 2)

s.Run("init verification success phone number with dashes", func() {
assertInitVerificationSuccess(handler, fakeClient, "226-821-3044", "fd276563a8232d16620da8ec85d0575f", 3)

s.Run("init verification success phone number with spaces", func() {
assertInitVerificationSuccess(handler, fakeClient, "2 2 6 8 2 1 3 0 4 7", "ce3e697125f35efb76357ed8e3b768b7", 4)
})
})
})
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to refactor the format because the sub-tests depend on the previous ones. Previously it wasn't a problem because the factory created a new instance of the service for every call of the VerificationService method.

Comment on lines 19 to 22
type InClusterApplication struct {
serviceFactory *factory.ServiceFactory
signupService service.SignupService
verificationService service.VerificationService
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the next PR(s), we will be able to deal with the services separately as they don't depend on each other anymore

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. Thanks!

Copy link

openshift-ci bot commented Feb 11, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

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 [MatousJobanek,alexeykazakov]

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

@MatousJobanek
Copy link
Contributor Author

/retest
flakiness

@MatousJobanek
Copy link
Contributor Author

/retest
flakiness

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.30%. Comparing base (bdaeecc) to head (816460e).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pkg/server/in_cluster_application.go 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #506      +/-   ##
==========================================
- Coverage   85.33%   85.30%   -0.04%     
==========================================
  Files          32       32              
  Lines        3116     3109       -7     
==========================================
- Hits         2659     2652       -7     
  Misses        371      371              
  Partials       86       86              
Flag Coverage Δ
unittests 85.30% <77.77%> (-0.04%) ⬇️

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.

@MatousJobanek MatousJobanek merged commit feb701c into codeready-toolchain:master Feb 12, 2025
10 of 12 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.

2 participants