Skip to content

Fixed broken tests#48613

Open
juan-fdz-hawa wants to merge 3 commits into
mainfrom
48467-fix-broken-tests
Open

Fixed broken tests#48613
juan-fdz-hawa wants to merge 3 commits into
mainfrom
48467-fix-broken-tests

Conversation

@juan-fdz-hawa

@juan-fdz-hawa juan-fdz-hawa commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
  • Fixed broken tests introduced in a90eab6
  • Fixed flaky TestIntegrations/TestListHostsByLabel
  • Fixed flaky TestIntegrations/TestHostsReportDownload

@juan-fdz-hawa juan-fdz-hawa requested a review from a team as a code owner July 2, 2026 11:21

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ef77e03f-a083-4081-ae16-dcd6644ab90b

📥 Commits

Reviewing files that changed from the base of the PR and between 370295e and 93f7098.

📒 Files selected for processing (2)
  • cmd/fleetctl/fleetctl/gitops_test.go
  • server/service/integration_core_test.go
👮 Files not reviewed due to content moderation or server errors (2)
  • cmd/fleetctl/fleetctl/gitops_test.go
  • server/service/integration_core_test.go

Warning

Walkthrough skipped

File diffs could not be summarized.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 48467-fix-broken-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@juan-fdz-hawa juan-fdz-hawa marked this pull request as draft July 2, 2026 11:23
@juan-fdz-hawa juan-fdz-hawa marked this pull request as ready for review July 2, 2026 11:36
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.03%. Comparing base (7023c5b) to head (93f7098).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #48613   +/-   ##
=======================================
  Coverage   68.03%   68.03%           
=======================================
  Files        3678     3678           
  Lines      233789   233789           
  Branches    12454    12454           
=======================================
+ Hits       159047   159051    +4     
+ Misses      60434    60433    -1     
+ Partials    14308    14305    -3     
Flag Coverage Δ
backend 69.68% <ø> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

for _, row := range rows[1:] {
if row[0] == fmt.Sprint(hosts[2].ID) {
require.Equal(t, "a@b.c,b@b.c", row[2], row)
// the order of the emails is not guaranteed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the order of emails supposed to be guaranteed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have some inconsistency in our device mapping API sorting:

Fleet has two code paths that turn the same host_emails rows into a device_mapping array, and today they
disagree:

Path A — sorted (ORDER BY email, source) via listHostDeviceMappingDB → ListHostDeviceMapping. This
serves:

  • GET /hosts/{id}/device_mapping — the host details page (hosts.go:2240)
  • PUT /hosts/{id}/device_mapping — returns the updated list after adding a custom email (hosts.go:2357)
  • GET /device/{token}/device_mapping — the end-user "My Device" page (devices.go:420)

Path B — unordered (GROUP_CONCAT with no ORDER BY) via the list query. This serves:

  • GET /hosts?device_mapping=true — the Hosts table (hosts.go:1311)
  • GET /labels/{id}/hosts?device_mapping=true — a label's host list (labels.go:1237)
  • GET /hosts/report — the CSV export (same query)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ok to merge this fix as is and file a new bug to fix the inconsistencies, TMWYT

@juan-fdz-hawa juan-fdz-hawa Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my guess is that users don't care about the ordering (no bug reported yet), so that's why it made sense to fix this at the test layer instead of changing production code ATM.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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