#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"

export ULTI_TEST_INTEGRATION=1

if [[ -f .env.test ]]; then
  set -a
  # shellcheck disable=SC1091
  source .env.test
  set +a
fi

if [[ $# -eq 0 ]]; then
  exec go test -tags=integration ./internal/integrationtest/... -count=1 -timeout=10m
fi

exec go test -tags=integration -count=1 -timeout=10m "$@"
