#!/usr/bin/env bats # backupstrategy-controller ships its strategy.backups.cozystack.io CRDs as # ordinary templates in the same release as the default Strategy CRs. Helm maps # every document of a release through the RESTMapper before it applies any, so # one Strategy CR whose CRD is not served yet fails the whole release with "no # matches for kind" and applies nothing, the CRDs included. That happens on the # upgrade that first ships a kind, and on the first render of an external-S3 # install, where the bucket gate is already open. Every default Strategy must # therefore also gate on its CRD being established (the crdEstablished helper). # # helm-unittest can only pin the templates someone remembered to list. These # cases discover the templates from the render itself, so a new # strategy-*-default.yaml without the CRD gate fails here without anyone # touching a test. # # Harness compatibility note: CI runs this file under Bats through # `make bats-unit-tests`. It also remains compatible with the narrower legacy # `hack/cozytest.sh` translator, so it avoids `run`, `$status`, `$output`, # `skip`, and setup()/teardown(). Paths stay repo-root-relative for both # runners. # # Run with: bats hack/backupstrategy-crd-gate.bats load test_helper CHART=packages/system/backupstrategy-controller STRATEGY_API='strategy.backups.cozystack.io/' # Every Strategy CR in the render under $1, one "