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

de-dup host_software and host_vpp_software_installs #28185

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ksykulev
Copy link
Contributor

@ksykulev ksykulev commented Apr 12, 2025

Checklist for submitter

#28156

If some of the following don't apply, delete the relevant line.

  • Added/updated automated tests
  • A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it)
  • Manual QA for all new/changed functionality

@ksykulev ksykulev requested a review from a team as a code owner April 12, 2025 03:59
Copy link
Member

@iansltx iansltx left a 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.

@@ -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
Copy link
Member

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{
Copy link
Member

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.

Copy link

codecov bot commented Apr 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.00%. Comparing base (fa8c087) to head (89eea2d).

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     
Flag Coverage Δ
backend 65.05% <100.00%> (+<0.01%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@iansltx iansltx left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants