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

test: cover project id filtering on bulk actions [ET-138] #9870

Merged

Conversation

jesse-amano-hpe
Copy link
Contributor

@jesse-amano-hpe jesse-amano-hpe commented Aug 27, 2024

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 if ProjectID is already mandatory field and we don't (contrary to the godoc for the filter attributes) actually support using ProjectID: 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

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.68%. Comparing base (b4209ef) to head (95abcb7).
Report is 8 commits behind head on main.

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           
Flag Coverage Δ
backend 45.20% <ø> (ø)
harness 72.62% <ø> (ø)
web 54.43% <ø> (ø)

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

see 8 files with indirect coverage changes

Copy link

netlify bot commented Aug 27, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 95abcb7
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/66d73321e721680008d3d70e

@jesse-amano-hpe jesse-amano-hpe force-pushed the jta/activate-experiments-coverage-testing-ET-138 branch from 3cd9898 to 0cab5b9 Compare August 27, 2024 06:15
@jesse-amano-hpe jesse-amano-hpe requested review from ashtonG and removed request for ashtonG August 27, 2024 18:16
Comment on lines +79 to +90
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++
Copy link
Contributor

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)
}

@jesse-amano-hpe jesse-amano-hpe force-pushed the jta/activate-experiments-coverage-testing-ET-138 branch from 817d536 to 95abcb7 Compare September 3, 2024 16:02
@jesse-amano-hpe jesse-amano-hpe merged commit 55b3f9b into main Sep 5, 2024
83 of 96 checks passed
@jesse-amano-hpe jesse-amano-hpe deleted the jta/activate-experiments-coverage-testing-ET-138 branch September 5, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants