Skip to content

FLPATH-3558 Automate acm tests#8

Merged
testetson22 merged 3 commits into
dcm-project:mainfrom
testetson22:flpath-3558-automate-acm-tests
Apr 14, 2026
Merged

FLPATH-3558 Automate acm tests#8
testetson22 merged 3 commits into
dcm-project:mainfrom
testetson22:flpath-3558-automate-acm-tests

Conversation

@testetson22

@testetson22 testetson22 commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Integrate the ACM Cluster Service Provider into the DCM E2E stack with automated API tests, compose overlay, and optional ACM/MCE deployment. Refactor deploy-dcm.sh with a declarative provider registry (providers/*.conf) so adding new service providers requires no changes to flag parsing, usage, or compose wiring.

Key Changes

  1. Provider registry: Declarative providers/*.conf files replace hardcoded per-provider logic in deploy-dcm.sh. Flags, usage, compose args, validation, and env exports are all generated from the registry. Current providers: kubevirt, k8s-container, acm-cluster
  2. ACM Cluster SP E2E tests: Health endpoint (schema, status, uptime), registration with SPRM, input validation (empty body, missing fields, wrong types, RFC 7807), CRUD basics (list, 404 get/delete) — gated by HyperShift CRD availability
  3. ACM/MCE deployment: --deploy-acm / --deploy-mce install ACM or MCE on the OCP cluster. Idempotent — detects existing installations, creates missing CRs, or runs the full upstream script as needed. Clones acm-cluster-service-provider repo for hack/deploy-acm-mce.sh
  4. ACM compose overlay: tests/compose-acm-cluster-sp.yaml adds the ACM SP container with kubeconfig mount, pull secret, and NATS wiring. Auto-injected by the provider registry
  5. Deploy script enhancements: ensure_podman_running() auto-starts the Podman machine; validate_acm_cluster_provider() creates the target namespace and resolves the pull secret from the cluster's global openshift-config/pull-secret
  6. Test harness integration: run-e2e.sh forwards --acm-cluster-service-provider, --deploy-acm/mce, and --acm-cluster-sp-repo/branch flags; exports DCM_ACM_CLUSTER_SP_URL
  7. CI: script validation workflow: .github/workflows/validate-scripts.yaml validates flag parsing, provider registry loading, mutual exclusivity (--deploy-acm + --deploy-mce), required-arg enforcement, and unknown flag rejection for both deploy-dcm.sh (11 cases) and run-e2e.sh (5 cases) — runs without deployment infrastructure

ACM Cluster SP Test Coverage

Per upstream spec PR #2:

Status Tests
Automated Registration with SPRM (cluster provider), health endpoint (schema, status, uptime progression), input validation (empty body, missing fields, wrong types, RFC 7807), CRUD basics (list, 404 get, 404 delete)
Gated CRUD lifecycle tests require HyperShift CRDs — skip gracefully without ACM
Follow-up NATS status events — SP monitoring not yet active in container deployment; upstream version matrix (DefaultCompatibilityMatrix) needs OCP 4.19+ entries

Provider Registry

Service providers are defined declaratively in providers/*.conf:

Provider Config Compose Validation
KubeVirt providers/kubevirt.conf Profile in api-gateway compose.yaml CNV CRDs + namespace
K8s Container providers/k8s-container.conf Profile + tests/compose-sp-test.yaml overlay Namespace creation
ACM Cluster providers/acm-cluster.conf tests/compose-acm-cluster-sp.yaml overlay Namespace + pull secret

Adding a new provider requires only a .conf file and (optionally) a validation hook function in deploy-dcm.sh.


ACM/MCE Deployment Flow

--deploy-acm / --deploy-mce follows this idempotent flow:

  1. Check if the CR (MultiClusterHub or MultiClusterEngine) is already Runningskip
  2. Check if the operator CSV is installed but CR is missing → create CR
  3. Check if the operator CSV is installed and CR exists but not Running → wait
  4. Nothing installed → clone upstream repo, run hack/deploy-acm-mce.sh
  5. Wait for CR to reach Running (default timeout: 1200s via DEPLOY_TIMEOUT)

No redundancy with upstream/product repo tests. The ACM Cluster SP repo (dcm-project/acm-cluster-service-provider) has extensive unit and integration tests (health, registration, handler, monitoring, cluster operations, config, status mappers) but these all test internal Go packages in isolation or with mocked dependencies. Our tests are external E2E tests that hit the running SP over HTTP through the compose stack -- a fundamentally different test layer.

Area Upstream (unit/integration) Our E2E tests
Health health_unit_test.go, health_integration_test.go Health endpoint schema, status values, uptime progression over real HTTP
Registration registration_unit_test.go, registration_integration_test.go Verifies the SP actually registers as service_type=cluster via the gateway's /providers API
Input validation handler_unit_test.go, server_unit_test.go POST /clusters with empty body, missing fields, wrong types, RFC 7807 response -- over the network
CRUD server_integration_test.go, cluster_test.go GET/DELETE 404s for non-existent clusters, list endpoint -- gated by HyperShift CRDs on a real cluster

The upstream tests validate internal correctness; ours validate the deployed service behaves correctly as part of the full DCM stack. No overlap.

Checklist

  • Provider registry (providers/*.conf) replaces hardcoded provider logic
  • ACM Cluster SP E2E tests (health, registration, validation, CRUD)
  • ACM compose overlay with kubeconfig, pull secret, NATS wiring
  • ACM/MCE idempotent deployment (--deploy-acm, --deploy-mce)
  • ensure_podman_running() auto-starts Podman machine
  • validate_acm_cluster_provider() creates namespace + resolves pull secret
  • make test-acm-sp target
  • Test harness forwards ACM flags and exports DCM_ACM_CLUSTER_SP_URL
  • CI workflow validates script flags and provider registry (16 test cases)
  • Documentation updated (README, CLAUDE.md, Cursor rules, compose comments)
  • ShellCheck clean
  • go vet clean

… and multi-sp testing

- Updated CLAUDE.md to include service provider configuration details and deployment options for ACM and MCE.
- Expanded README.md to clarify the service provider registry and prerequisites for using ACM and KubeVirt providers.
- Modified deploy-dcm.sh to support dynamic loading of service providers from configuration files, improving extensibility.
- Updated run-e2e.sh to include new service provider flags for ACM and MCE deployments.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
Refactor deploy-dcm.sh to use declarative provider registry
(providers/*.conf) replacing hardcoded per-provider logic. Add ACM
cluster SP E2E tests (health, registration, validation, CRUD), compose
overlay, idempotent --deploy-acm/--deploy-mce support, and
ensure_podman_running auto-start.
Add GH action to validate scripts

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
- Updated namespace resolution to use indirect variable expansion for better clarity.
- Enhanced error reporting when starting the Podman machine by capturing output.
- Ensured temporary directories are removed after deployment attempts, regardless of success or failure.

Additionally, added comments in compose-acm-cluster-sp.yaml to clarify the use of the latest image for active development.

Signed-off-by: Thomas Stetson <tstetson@redhat.com>
@testetson22 testetson22 merged commit 6cb793f into dcm-project:main Apr 14, 2026
5 checks passed
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