Skip to content

Add integration tests for 10 new CLI commands - #33

Open
pjcdawkins wants to merge 8 commits into
mainfrom
add-integration-tests
Open

Add integration tests for 10 new CLI commands#33
pjcdawkins wants to merge 8 commits into
mainfrom
add-integration-tests

Conversation

@pjcdawkins

Copy link
Copy Markdown
Contributor

Summary

  • Add integration tests for 10 previously uncovered CLI commands, organized in 3 phases
  • Expand mock API with DELETE handlers for variables, POST handlers for environment lifecycle operations, and new models/handlers for domains, integrations, and certificates
  • Add stub endpoints for /projects/{id}/settings and /projects/{id}/capabilities

Phase 1: No mock changes needed

  • decode: base64+JSON decoding, property extraction, invalid input
  • environment:url: --pipe and --primary flags in both API and local modes
  • environment:relationships: local mode via env var, property path extraction

Phase 2: POST/DELETE mock handlers

  • variable:delete: project-level and env-level deletion with verification
  • environment:activate: activate inactive env, already-active detection
  • environment:pause / environment:resume: pause and resume lifecycle
  • environment:redeploy: redeploy via HAL link, error when unavailable

Phase 3: New mock models and handlers

  • domain:list / domain:get: table output, property extraction, empty list
  • integration:list / integration:get: multiple types, property extraction
  • certificate:list / certificate:get: cert details, empty list

🤖 Generated with Claude Code

CopilotAI review requested due to automatic review settings March 20, 2026 19:28

CopilotAI left a comment

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.

Pull request overview

This PR expands the mock API surface area and adds integration tests to cover previously untested CLI commands around decoding, environment operations, variables, and project resources (domains/integrations/certificates).

Changes:

  • Added new mock API models plus handlers/routes for domains, integrations, certificates, variable deletion, and environment lifecycle operations.
  • Added stub mock endpoints for /projects/{id}/settings and /projects/{id}/capabilities.
  • Added integration tests covering decode, environment url/relationships, environment activate/pause/resume/redeploy, variable deletion, and list/get for domains/integrations/certificates.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
pkg/mockapi/api_server.goWires up new mock routes for settings/capabilities, env lifecycle ops, resource list/get, and variable delete endpoints.
pkg/mockapi/variables.goAdds variable DELETE handlers and a small helper for activity-embedded responses.
pkg/mockapi/environments.goAdds mock handlers for activate/pause/resume/redeploy endpoints.
pkg/mockapi/store.goExtends the mock store with per-project domains/integrations/certificates + setters.
pkg/mockapi/model.goIntroduces Domain/Integration/Certificate mock models.
pkg/mockapi/domains.goAdds list/get handlers for project domains.
pkg/mockapi/integrations.goAdds list/get handlers for project integrations.
pkg/mockapi/certificates.goAdds list/get handlers for project certificates.
integration-tests/decode_test.goIntegration coverage for decode including property extraction and invalid input.
integration-tests/environment_url_test.goCovers environment:url in API and local modes (--pipe, --primary).
integration-tests/environment_relationships_test.goCovers local-mode environment:relationships and property extraction.
integration-tests/variable_delete_test.goCovers project and environment variable deletion.
integration-tests/environment_activate_test.goCovers activating an inactive environment and detecting already-active envs.
integration-tests/environment_pause_test.goCovers environment:pause and environment:resume.
integration-tests/environment_redeploy_test.goCovers redeploy via HAL link and error when link is missing.
integration-tests/domain_test.goCovers domain list/get and empty-list behavior.
integration-tests/integration_test.goCovers integration list/get and property extraction.
integration-tests/certificate_test.goCovers certificate list/get and empty-list behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadintegration-tests/domain_test.go
pjcdawkinsand others added 8 commits April 10, 2026 12:23
Phase 1 of integration test expansion. These commands need no mock API
changes:
- decode: base64+JSON decoding, property extraction, invalid input
- environment:url: --pipe and --primary flags, both API and local modes
- environment:relationships: local mode via PLATFORM_RELATIONSHIPS env var,
property extraction with fully-qualified paths
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ume, redeploy
Phase 2 of integration test expansion. Mock API changes:
- Add DELETE handlers for project and env-level variables
- Add POST handlers for activate, pause, resume, redeploy on environments
- Add stub endpoints for /projects/{id}/settings and /projects/{id}/capabilities
Tests cover:
- variable:delete: project-level delete with verification, env-level delete
- environment:activate: activate inactive env, already-active detection
- environment:pause/resume: pause active env, resume paused env
- environment:redeploy: redeploy with HAL link, error without HAL link
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 3 of integration test expansion. New mock API components:
- Domain, Integration, Certificate models in model.go
- Store setters for each new resource type
- Handler files: domains.go, integrations.go, certificates.go
- GET list/get routes registered in api_server.go
Tests cover:
- domain:list/get: table output, property extraction, empty list
- integration:list/get: multiple types (github, webhook), property extraction
- certificate:list/get: cert details, property extraction, empty list
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address review feedback: assert that the CLI exits with an error when
no domains are found, not just that stderr contains the message.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CLI currently exits non-zero when no domains are found, but this is
inconsistent with other list commands (services, certificates exit 0).
Don't assert the exit code either way so the test is resilient to a
future fix.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add TestRelationshipsRemote that fetches relationships over SSH using the
mock SSH server, matching the pattern used by ssh_test.go and
valkey_test.go. Extract shared relationship data into mockRelationships()
helper.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Break a long line to stay within the 120-character limit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for freeto 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

@pjcdawkins