feat(usable): integrate current dbtool implementation snapshot
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -6,6 +6,7 @@ tmp_dir="$(mktemp -d)"
|
||||
state_dir="$tmp_dir/state"
|
||||
fake_bin_dir="$tmp_dir/bin"
|
||||
output_dir="$tmp_dir/out"
|
||||
docker_log="$tmp_dir/docker.log"
|
||||
mkdir -p "$state_dir/container_fs" "$fake_bin_dir" "$output_dir"
|
||||
|
||||
cleanup() {
|
||||
@@ -31,10 +32,13 @@ set -euo pipefail
|
||||
|
||||
state_dir="${MOCK_DOCKER_STATE_DIR:?}"
|
||||
container_fs="$state_dir/container_fs"
|
||||
docker_log="${MOCK_DOCKER_LOG:?}"
|
||||
|
||||
cmd="${1:?}"
|
||||
shift
|
||||
|
||||
printf '%s %s\n' "$cmd" "$*" >>"$docker_log"
|
||||
|
||||
copy_into_container() {
|
||||
local src="$1"
|
||||
local dest="$2"
|
||||
@@ -143,6 +147,7 @@ chmod +x "$fake_bin_dir/docker"
|
||||
|
||||
export PATH="$fake_bin_dir:$PATH"
|
||||
export MOCK_DOCKER_STATE_DIR="$state_dir"
|
||||
export MOCK_DOCKER_LOG="$docker_log"
|
||||
export QA_HOST_LABEL="runner-host-01"
|
||||
export QA_BINARY_PATH_LABEL="./target/release/dbtool"
|
||||
export QA_BINARY_VERSION="dbtool 0.1.0"
|
||||
@@ -157,12 +162,34 @@ evidence_file="$output_dir/PG-CONN-AUTH-001.md"
|
||||
exit 95
|
||||
}
|
||||
|
||||
grep -Fq 'Host: `runner-host-01`' "$evidence_file"
|
||||
grep -Fq 'Execution Path: `sidecar`' "$evidence_file"
|
||||
grep -Fq 'Binary Path: `./target/release/dbtool`' "$evidence_file"
|
||||
grep -Fq 'Binary Version: `dbtool 0.1.0`' "$evidence_file"
|
||||
grep -Fq 'Commit SHA: `' "$evidence_file"
|
||||
grep -Fq 'Branch: `' "$evidence_file"
|
||||
grep -Fq 'Result: `pass`' "$evidence_file"
|
||||
grep -Fq 'exec -e PGPASSWORD=dbtoolroot -i dbtool-cli-v1-postgres-1 psql -v ON_ERROR_STOP=1 -U postgres -d dbtool_demo' "$docker_log" || {
|
||||
echo "expected sidecar helper to reseed postgres with admin credentials" >&2
|
||||
exit 98
|
||||
}
|
||||
|
||||
expected_lines=(
|
||||
'### PG-CONN-AUTH-001'
|
||||
'- Host: `runner-host-01`'
|
||||
'- Execution Path: `sidecar`'
|
||||
'- Binary Path: `./target/release/dbtool`'
|
||||
'- Binary Version: `dbtool 0.1.0`'
|
||||
'- Commit SHA: `'
|
||||
'- Branch: `'
|
||||
'- Result: `pass`'
|
||||
)
|
||||
|
||||
last_line=0
|
||||
for expected in "${expected_lines[@]}"; do
|
||||
current_line="$(grep -nF -- "$expected" "$evidence_file" | head -n 1 | cut -d: -f1)"
|
||||
if [ -z "$current_line" ]; then
|
||||
echo "missing expected sidecar markdown line: $expected" >&2
|
||||
exit 96
|
||||
fi
|
||||
if [ "$current_line" -le "$last_line" ]; then
|
||||
echo "sidecar markdown order regression near: $expected" >&2
|
||||
exit 97
|
||||
fi
|
||||
last_line="$current_line"
|
||||
done
|
||||
|
||||
echo "sidecar helper fixture passed"
|
||||
|
||||
Reference in New Issue
Block a user