-
Notifications
You must be signed in to change notification settings - Fork 15
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
BCDA-8351: Exclude MD TCoC requests from suppression #993
base: main
Are you sure you want to change the base?
Conversation
ignoredMBIs, err = s.repository.GetSuppressedMBIs(ctx, s.sp.lookbackDays, upperBound) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to retreive suppressedMBIs %s", err.Error()) | ||
if cfg, ok := s.GetACOConfigForID(conditions.CMSID); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already get the config in our middleware when a request is made, so this feels a little redundant. Having something similar to line 493 or adding it as a request condition may have been better, so I am open to discussing this one!
@@ -170,7 +173,7 @@ func (s *ServiceTestSuite) TearDownTest() { | |||
conf.SetEnv(s.T(), "PRIORITY_ACO_REG_EX", s.priorityACOsEnvVar) | |||
} | |||
|
|||
func (s *ServiceTestSuite) TestIncludeSuppressedBeneficiaries() { | |||
func (s *ServiceTestSuite) TestIncludeSuppressedBeneficiariesIntegration() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really liked the strategy outlined in the second response in this post about how to discern between unit and integration tests when running tests, hence the name updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick thought: What about TestIncludeSuppressedBeneficiaries_Integration
? Makes it pop out more to me.
Is there a case to be made for adding the t.Short
clause or do we pretty much always want to run everything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and yes! I like the snake_case to make it more visible and eventually, we would want to include the if t.short; t.skip()
line in the integration tests!
@@ -225,7 +228,7 @@ func (s *ServiceTestSuite) TestIncludeSuppressedBeneficiaries() { | |||
} | |||
} | |||
|
|||
func (s *ServiceTestSuite) TestGetNewAndExistingBeneficiaries() { | |||
func (s *ServiceTestSuite) TestGetNewAndExistingBeneficiariesIntegration() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2-3 tests that I had to make minor updates to; because we are filtering by the ACO model now, the configured test CMS ID of cmsID
was not being parsed and these tests also weren't loading the config files to do the parsing.
} | ||
|
||
func (s *ServiceTestSuiteWithDatabase) TestGetNewAndExistingBeneficiaries_RecentSinceParameterDatabaseIntegration() { | ||
db := database.Connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was an already existing test that it utilizing the database's package init()
. I moved it under the new test suite since we should eventually remove the dependency on init() and instead use the 'CreateDatabase` function to stand up our test databases. I will continue to work on this if it fits into the sprint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not fully following all of this, maybe we can talk offline and would love to get Kevins perspective here.
if err != nil { | ||
return nil, fmt.Errorf("failed to retreive suppressedMBIs %s", err.Error()) | ||
if cfg, ok := s.GetACOConfigForID(conditions.CMSID); ok { | ||
if cfg.Model != "TCOCMD" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In NewService
Im seeing:
return &service{
...
sp: suppressionParameters{
includeSuppressedBeneficiaries: false,
lookbackDays: cfg.SuppressionLookbackDays,
},
...
Is there a reason we cant use includeSuppressedBeneficiaries
as opposed to a hardcode check of "TCOCMD"?
This means when we create the MD TCoC service (or link it to the ACO?) we will have to override the suppression parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I saw that too and would much more prefer to use that but it's part of the service structure that's instantiated with our handlers (called on service start instead of per request).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so a service is instantiated on app start. But we pass something in as part of each request (ACO ID?) to get the specific request ACO out of all of the available ACOConfigs of the service. It looks like we are pulling ACOConfigs from files in conf/config/{env}.yml? Is there a reason we cant add onto these a new field eg ignoreSuppressed
?
Somewhat related question how do these ACOConfigs compare with what we have in the acos DB table? Looks like the DB table is just identifiers and web/auth related, no config?
@@ -170,7 +173,7 @@ func (s *ServiceTestSuite) TearDownTest() { | |||
conf.SetEnv(s.T(), "PRIORITY_ACO_REG_EX", s.priorityACOsEnvVar) | |||
} | |||
|
|||
func (s *ServiceTestSuite) TestIncludeSuppressedBeneficiaries() { | |||
func (s *ServiceTestSuite) TestIncludeSuppressedBeneficiariesIntegration() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick thought: What about TestIncludeSuppressedBeneficiaries_Integration
? Makes it pop out more to me.
Is there a case to be made for adding the t.Short
clause or do we pretty much always want to run everything?
mbis []string | ||
}{ | ||
{"TCOCMD request with active suppressions", "TCOCMD", 7, []string{"MBI00000001", "MBI00000002", "MBI00000003", "MBI00000004", "MBI00000005", "MBI00000006", "MBI00000007"}}, | ||
{"Non TCOCMD request with active suppressions", "A0001", 4, []string{"MBI00000004", "MBI00000005", "MBI00000006", "MBI00000007"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to trying to move the check for "TCOC" to a var, could we rename these to something like:
"ACO with ignored suppressions request with active suppressions" and
"ACO request with active suppressions"
I think keeping specifics out keeps things a bit cleaner down the road.
} | ||
|
||
func (s *ServiceTestSuiteWithDatabase) TestGetNewAndExistingBeneficiaries_RecentSinceParameterDatabaseIntegration() { | ||
db := database.Connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not fully following all of this, maybe we can talk offline and would love to get Kevins perspective here.
github.com/golang-migrate/migrate/v4 v4.14.1 | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/golang/protobuf v1.5.4 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we close out this PR: #923?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that PR references a different package (weirdly), so we can check in to see if that PR can be merged.
🎫 Ticket
https://jira.cms.gov/browse/BCDA-8351
🛠 Changes
make unit-test
command.testdata
tofixtures
. Old files that were not in use were removed and new files have been addedℹ️ Context
To onboard TCOC, we must exclude beneficiary suppression with their requests.
🧪 Validation
Added integration test will seeded database for suppression data.