-
Notifications
You must be signed in to change notification settings - Fork 546
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
de-dup host_software and host_vpp_software_installs #28185
base: main
Are you sure you want to change the base?
Conversation
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 tweak here. I think we can get away with adamID only as an index because hosts only have one platform, but for querying we need to join on adam_id and platform.
server/datastore/mysql/software.go
Outdated
@@ -2740,7 +2741,9 @@ func hostVPPInstalls(ds *Datastore, ctx context.Context, hostID uint, globalOrTe | |||
(ua2.priority < ua.priority OR ua2.created_at > ua.created_at) | |||
LEFT JOIN | |||
vpp_apps_teams vat ON vaua.adam_id = vat.adam_id AND vaua.platform = vat.platform AND vat.global_or_team_id = :global_or_team_id | |||
WHERE | |||
INNER JOIN | |||
vpp_apps ON vaua.adam_id = vpp_apps.adam_id |
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.
These need to join on adam_id and platform; GitOps will actually create a vpp_apps
entry for each of the three associated platforms (iOS, iPadOS, macOS) when you specify an app ID, so if we just join on adam_id we'll get a subtle bug where there are more software titles than there should be.
require.NoError(t, err) | ||
time.Sleep(time.Second) | ||
|
||
vPPApp := &fleet.VPPApp{ |
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.
Per the above, you should be able to repro that issue by adding the same VPP app 3x, once each per platform.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #28185 +/- ##
=======================================
Coverage 64.00% 64.00%
=======================================
Files 1780 1780
Lines 170729 170741 +12
Branches 4952 4952
=======================================
+ Hits 109273 109285 +12
+ Misses 52843 52842 -1
- Partials 8613 8614 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Given that this is 11:20p on a Friday and this already improves test coverage from where we were (and I'm convinced that the platform join would do the right thing if we added more tests), LGTM.
Checklist for submitter
#28156
If some of the following don't apply, delete the relevant line.