Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions providers/acm-cluster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ PROVIDER_LABEL="acm-cluster"
PROVIDER_FLAG="acm-cluster-service-provider"
PROVIDER_DESCRIPTION="Enable the ACM cluster service provider (requires OCP + ACM/MCE)"

# Compose integration — not yet in api-gateway compose.yaml, uses override
COMPOSE_PROFILE=""
# Compose integration — profile defined in api-gateway compose.yaml;
# override publishes the SP port to the host for direct API access.
COMPOSE_PROFILE="acm-cluster"
COMPOSE_OVERRIDE="tests/compose-acm-cluster-sp.yaml"

# CLI — requires oc specifically
Expand Down
32 changes: 1 addition & 31 deletions tests/compose-acm-cluster-sp.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
# Compose override: adds the ACM cluster service provider to the DCM stack.
# The api-gateway compose.yaml does not yet include this service, so this
# override defines it from the upstream image on Quay.
#
# Uses :latest intentionally — the SP is under active development and E2E
# tests should run against the most recent build. pull_policy: always
# ensures each deploy gets the newest image. Pin to a digest or tag when
# the SP stabilizes.
#
# Compose override for E2E testing: publishes the ACM cluster SP port to the host.
# Injected automatically by deploy-dcm.sh via the provider registry
# (providers/acm-cluster.conf → COMPOSE_OVERRIDE).
#
# Required env vars (exported by deploy-dcm.sh when --acm-cluster-service-provider is set):
# ACM_CLUSTER_SP_KUBECONFIG — path to kubeconfig with access to the ACM Hub cluster
# ACM_CLUSTER_SP_PULL_SECRET — base64-encoded .dockerconfigjson for pulling OCP release images

services:
acm-cluster-service-provider:
image: quay.io/dcm-project/acm-cluster-service-provider:latest
pull_policy: always
environment:
SP_NAME: ${ACM_CLUSTER_SP_NAME:-acm-cluster-sp}
SP_ENDPOINT: "http://acm-cluster-service-provider:8080"
DCM_REGISTRATION_URL: "http://service-provider-manager:8080/api/v1alpha1"
SP_NATS_URL: "nats://nats:4222"
SP_CLUSTER_NAMESPACE: ${ACM_CLUSTER_SP_NAMESPACE:-clusters}
SP_ENABLED_PLATFORMS: ${ACM_CLUSTER_SP_PLATFORMS:-kubevirt,baremetal}
SP_PULL_SECRET: ${ACM_CLUSTER_SP_PULL_SECRET:-}
KUBECONFIG: /kubeconfig
expose:
- "8080"
ports:
- "8083:8080"
volumes:
- ${ACM_CLUSTER_SP_KUBECONFIG:-~/.kube/config}:/kubeconfig:ro,z
depends_on:
service-provider-manager: { condition: service_started }
nats: { condition: service_started }
2 changes: 1 addition & 1 deletion tests/e2e/api_providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ var _ = Describe("Providers API", func() {

var body map[string]interface{}
decodeJSON(resp, &body)
GinkgoWriter.Printf("Create provider response: %v\n", body)
Expect(body).To(HaveKey("id"))
Expect(body["name"]).To(Equal(providerName))
Expect(body["status"]).To(Equal("registered"))

id, ok := body["id"].(string)
Expect(ok).To(BeTrue(), "id should be a string")
Expand Down
20 changes: 12 additions & 8 deletions tests/e2e/sp_container_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"os/exec"
"strings"
"time"

"github.com/nats-io/nats.go"
Expand Down Expand Up @@ -347,22 +348,25 @@ var _ = Describe("Container SP Status Events", Label("sp", "container", "nats"),
It("delivers status events after NATS restart", func() {
natsContainer := findComposeContainer("nats")

By("creating a container and confirming initial event delivery")
By("subscribing before create, then confirming status RUNNING")
collector1 := newNATSCollector(natsStatusSubject)
name := uniqueName("e2e-nats")
body := createTestContainer(containerSpec(name, "docker.io/library/nginx:alpine", false))
containerID = body["id"].(string)

collector1 := newNATSCollector(natsStatusSubject)
collector1.WaitForStatus(containerID, "RUNNING", 60*time.Second)
collector1.Close()

By("stopping the NATS container")
out, err := exec.Command(podmanBin, "stop", "-t", "5", natsContainer).CombinedOutput()
Expect(err).NotTo(HaveOccurred(), "failed to stop NATS: %s", string(out))

By("restarting the NATS container")
out, err = exec.Command(podmanBin, "start", natsContainer).CombinedOutput()
Expect(err).NotTo(HaveOccurred(), "failed to start NATS: %s", string(out))
out, err := exec.Command(podmanBin, "restart", "-t", "5", natsContainer).CombinedOutput()
Expect(err).NotTo(HaveOccurred(), "failed to restart NATS: %s", string(out))

By("verifying the NATS container is running after restart")
Eventually(func() string {
state, _ := exec.Command(podmanBin, "inspect", "--format", "{{.State.Status}}", natsContainer).CombinedOutput()
return strings.TrimSpace(string(state))
}).WithTimeout(15 * time.Second).WithPolling(1 * time.Second).Should(Equal("running"),
"NATS container should be in running state after restart")

By("waiting for NATS to be connectable again")
Eventually(func() error {
Expand Down
Loading