-
Notifications
You must be signed in to change notification settings - Fork 356
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
test: cover project id filtering on bulk actions [ET-138] #9870
test: cover project id filtering on bulk actions [ET-138] #9870
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9870 +/- ##
=======================================
Coverage 54.68% 54.68%
=======================================
Files 1261 1261
Lines 156752 156752
Branches 3597 3597
=======================================
Hits 85723 85723
Misses 70898 70898
Partials 131 131
Flags with carried forward coverage won't be shown. Click here to find out more. |
✅ Deploy Preview for determined-ui canceled.
|
3cd9898
to
0cab5b9
Compare
allExperimentIds := make([]int, len(testModels)) | ||
editableExperiments := map[string]*model.Experiment{} | ||
i := 0 | ||
for name, model := range testModels { | ||
exp := db.RequireMockExperimentParams( | ||
t, db.SingleDB(), testUser, | ||
db.MockExperimentParams{ | ||
State: &state, | ||
}, | ||
testProjectID, | ||
model, | ||
*model.ProjectID, | ||
) | ||
editableExperiments[state] = exp | ||
editableExperiments[name] = exp | ||
allExperimentIds[i] = exp.ID | ||
i++ |
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.
The most minor of nits: you could get rid of i
if you allocate allExperimentIds
with len of zero and capacity of len(testModels)
and then just append()
.
allExperimentIds := make([]int, 0, len(testModels))
editableExperiments := map[string]*model.Experiment{}
for name, model := range testModels {
exp := db.RequireMockExperimentParams(
t, db.SingleDB(), testUser,
model,
*model.ProjectID,
)
editableExperiments[name] = exp
allExperimentIds = append(allExperimentIds, exp.ID)
}
817d536
to
95abcb7
Compare
Ticket
ET-138
Description
As requested here, puts some additional coverage on the filtering tests and enables some additional controls to improve on coverage further.
One observation out of this is that the filter logic appears to always return empty results if the project ID (outside the filters) is left zero-valued and the filter project ID must either be zero or match the other project ID. As I recall, we were questioning this design in our audit of the API for the run-centric story; I think we have a slightly clearer answer, thanks to this. I definitely think this behavior is quirky, and I lean toward thinking we probably shouldn't have
ProjectID
in the filters ifProjectID
is already mandatory field and we don't (contrary to the godoc for the filter attributes) actually support usingProjectID: 0,
to search across multiple projects. That said, I'm not sure if this deserves to be filed as a new ticket since I'm not sure what (if anything) this ought to change to.What's committed here are versions of the unit tests that pass -- we can add to the setup logic and testing tables to construct tests that fail in various ways (see above).
Test Plan
N/A
Checklist
docs/release-notes/
See Release Note for details.