Skip to content

test: additional coverage for clusters with services#274

Open
rshoemaker wants to merge 2 commits intomainfrom
test/PLAT-412/service_plan_tests
Open

test: additional coverage for clusters with services#274
rshoemaker wants to merge 2 commits intomainfrom
test/PLAT-412/service_plan_tests

Conversation

@rshoemaker
Copy link
Contributor

Follow-on PR that adds golden test coverage for service resources.

PLAT-412

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

The PR introduces comprehensive golden test data and helper infrastructure for service resource operations in database updates. New JSON test fixtures define expected operation sequences for adding, removing, and managing services, alongside test stubs and expanded test cases for service-aware database state transitions.

Changes

Cohort / File(s) Summary
Service Resource Test Fixtures
server/internal/database/operations/golden_test/TestUpdateDatabase/add_service_to_existing_database.json, remove_service_from_existing_database.json, single_node_with_service_from_empty.json, single_node_with_service_no-op.json, update_database_node_with_unchanged_service.json
New golden test data files defining resource operation sequences for service lifecycle: creating services across network, user role, instance spec, and instance resources; removing services in reverse dependency order; and handling service state transitions.
Test Infrastructure
server/internal/database/operations/helpers_test.go
Introduces service resource stubs (serviceNetworkResource, serviceUserRoleResource, serviceInstanceSpecResource, serviceInstanceResource) and a makeServiceResources factory function for constructing testable service dependencies without direct swarm package imports.
Test Case Expansion
server/internal/database/operations/update_database_test.go
Adds five new service-related test scenarios covering service creation from empty state, no-op validation, attachment to existing databases, removal, and node updates with unchanged services. Updates UpdateDatabase invocation to pass service resources for plan generation.

Poem

🐰 In golden test files, services take flight,
Adding, removing, getting updates just right,
Resources spin up, then gracefully bow,
From empty to full—the database knows how!
Our helper stubs dance in test harmony's song,
Making sure service ops never go wrong!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and missing most required template sections including Summary, Changes, Testing, and Checklist. Fill out all required template sections: expand Summary (2 sentences explaining what the PR does), detail Changes (bulleted list), document Testing steps, and complete the Checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: additional coverage for clusters with services' clearly and concisely describes the main change - adding test coverage for service resources in clusters.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/PLAT-412/service_plan_tests

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/internal/database/operations/helpers_test.go`:
- Around line 180-274: The test stub serviceInstanceSpecResource currently
inherits AnyExecutor from orchestratorResource but must mirror the real
ServiceInstanceSpecResource by overriding Executor(); add a hostID (or hostId)
field to serviceInstanceSpecResource and implement Executor() to return
resource.HostExecutor(r.hostID) instead of the default, so plan grouping matches
production behavior (ensure the Identifier(), Dependencies(), and DiffIgnore
remain unchanged).

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