Integration tests for non-proxied cert renewal#45663
Conversation
Adds end-to-end coverage for the public profile-upload API surface under Decision 2.6 (marker is opt-in). Four tests: - TestACMEProfileUploadAcceptsAllMarkerPlacements: 4-case matrix (preferred/legacy/no-marker × OU/CN placement) confirms acceptance across the board for com.apple.security.acme profiles. - TestRawSCEPProfileUploadAcceptsAllMarkerPlacements: same matrix for com.apple.security.scep payloads without Fleet proxy variables. - TestConditionalAccessProfileUploadsCleanly: renders Fleet's generated Conditional Access SCEP profile and confirms clean upload via custom OS settings. - TestWindowsSCEPProfilePreferredVariableAccepted: covers PR #45237's pre-existing-surface back-compat (NDES / Custom SCEP proxy SCEP accept the preferred variable name).
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
WalkthroughThis PR adds a new integration test file covering non-proxied certificate renewal profile uploads to the MDM Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/service/integration_mdm_non_proxied_cert_renewal_test.go`:
- Around line 193-197: The replacement using bytes.ReplaceAll on
windowsDeviceSCEPProfileForRenewalTest into preferred may silently no-op; add
assertions that the legacy token exists before replacement and that the new
token exists after replacement. Specifically, assert
bytes.Contains(windowsDeviceSCEPProfileForRenewalTest,
[]byte("$FLEET_VAR_SCEP_RENEWAL_ID")) before calling bytes.ReplaceAll, then
assert bytes.Contains(preferred, []byte("$FLEET_VAR_CERTIFICATE_RENEWAL_ID"))
(and optionally assert !bytes.Contains(preferred,
[]byte("$FLEET_VAR_SCEP_RENEWAL_ID"))) after to ensure the swap actually
occurred prior to the upload step.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0019fb44-e33d-4b89-8cf0-f4cb08088b24
📒 Files selected for processing (1)
server/service/integration_mdm_non_proxied_cert_renewal_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 40639-cert-renew #45663 +/- ##
===================================================
Coverage ? 66.76%
===================================================
Files ? 2746
Lines ? 219484
Branches ? 10831
===================================================
Hits ? 146538
Misses ? 59707
Partials ? 13239
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:
|
bytes.ReplaceAll silently no-ops if the legacy token isn't in the fixture. Assert before-and-after so a future fixture change can't mask the swap failing.
Related issue: Resolves #45250
Summary by CodeRabbit
Release Notes