#!/usr/bin/env bash
#MISE description="tilt ci for the infra the database-backed integration tests need (no app images, no Ceph)"
#MISE dir="{{config_root}}"
# The closure of what `mise test:integration:k3d` consumes: chart repos, the
# CNPG operator + database, mock-oidc and the victoria pair. Two absences are
# deliberate:
#
#   - the four app images (yucca-api/admin/web/michael) — those tests boot the
#     apps on the host themselves;
#   - Rook-Ceph — converging it took longer than every test in the job put
#     together, and nothing left here talks to S3. The S3-backed suites run
#     against the e2e stack's real RGW instead (mise test:integration:s3).
set -euo pipefail

if ! kubectl config current-context | grep -q '^k3d-yucca$'; then
  echo "Current kube context is not k3d-yucca. Run: mise k3d:up" >&2
  exit 1
fi

exec tilt ci --timeout 1800s \
  helm-deps cloudnative-pg yucca-database yucca-mock-oidc \
  yucca-victoria-metrics yucca-victoria-logs
