#!/bin/sh # Fake credentials-migrate for hack/migration-64-postgres-credentials.bats. # Migration 64 runs `credentials-migrate seed` in the hook; the real binary is # exercised by cmd/credentials-migrate's Go tests, so this fake only records the # call and fails on demand to pin the hook's fail-closed behaviour. # # FAKE_CMDLOG file to append a one-line record of each call to # FAKE_SEED_FAIL non-empty => `seed` exits 1 with this stderr set -u [ -n "${FAKE_CMDLOG:-}" ] && printf 'CREDMIGRATE %s\n' "$*" >> "$FAKE_CMDLOG" case "${1:-}" in seed) if [ -n "${FAKE_SEED_FAIL:-}" ]; then printf '%s\n' "$FAKE_SEED_FAIL" >&2 exit 1 fi exit 0 ;; esac exit 0