diff --git a/packages/core/platform/sources/mongodb-application.yaml b/packages/core/platform/sources/mongodb-application.yaml index 67f7f25c6..8b30e2f29 100644 --- a/packages/core/platform/sources/mongodb-application.yaml +++ b/packages/core/platform/sources/mongodb-application.yaml @@ -15,6 +15,15 @@ spec: - cozystack.networking # cozystack-engine ships the ApplicationDefinition CRD rendered by the *-rd component below. - cozystack.cozystack-engine + # The mongodb chart renders kind: PerconaServerMongoDB from + # psmdb.percona.com/v1, so the operator that serves that CRD is a + # prerequisite of offering the app at all. Without this edge the + # mongodb-rd HelmRelease registers the ApplicationDefinition as soon as + # the engine is up, a tenant can create a MongoDB before the operator + # exists, and its HelmRelease fails with `no matches for kind + # "PerconaServerMongoDB"`. Same shape as every other operator-backed app + # here (postgres, mariadb, kafka, redis, etcd). + - cozystack.mongodb-operator libraries: - name: cozy-lib path: library/cozy-lib diff --git a/packages/core/platform/tests/sources_mongodb_application_dependson_test.yaml b/packages/core/platform/tests/sources_mongodb_application_dependson_test.yaml new file mode 100644 index 000000000..4cbbe0247 --- /dev/null +++ b/packages/core/platform/tests/sources_mongodb_application_dependson_test.yaml @@ -0,0 +1,31 @@ +suite: mongodb-application waits for the operator that serves its CRD +# The mongodb chart (apps/mongodb) renders kind: PerconaServerMongoDB from +# psmdb.percona.com/v1, so cozystack.mongodb-operator is a genuine prerequisite +# of offering the app rather than a test-selection hint. Without this edge the +# mongodb-rd HelmRelease registers the ApplicationDefinition as soon as +# cozystack-engine is up, a tenant can create a MongoDB before the operator +# exists, and its HelmRelease fails with `no matches for kind +# "PerconaServerMongoDB"`. +# The edge is also what makes the mongodb Chainsaw suite reachable from the +# operator's own package, so a change to the operator selects that suite instead +# of the whole run — see hack/select-e2e.sh's src_to_suites(). +templates: + - templates/sources.yaml +release: + name: cozystack + namespace: cozy-system +tests: + - it: mongodb-application dependsOn mongodb-operator alongside its baseline edges + documentSelector: + path: metadata.name + value: cozystack.mongodb-application + asserts: + - contains: + path: spec.variants[0].dependsOn + content: cozystack.mongodb-operator + - contains: + path: spec.variants[0].dependsOn + content: cozystack.networking + - contains: + path: spec.variants[0].dependsOn + content: cozystack.cozystack-engine