docs: migrator: ~ logs & comments

This commit is contained in:
2026-06-10 12:26:16 +00:00
parent fba150b55b
commit 2d5bd26c36
2 changed files with 54 additions and 11 deletions
@@ -1,6 +1,6 @@
log notice "test case: ${WHITE}error: ambiguous command"
set +e
migrator --inherits tablename --inherits 'table name' list migrate
migrator --inherits tablename --inherits 'table name' list migrate >/tmp/migrator-arguments-1.out 2>&1
error_code=$?
set -e
@@ -12,9 +12,14 @@ elif [ "$error_code" != 2 ]; then
exit 1
fi
if ! grep -q 'ambiguous subcommand' /tmp/migrator-arguments-1.out; then
log error "test failed: ${WHITE}missing ambiguous subcommand diagnostic"
exit 1
fi
log notice "test case: ${WHITE}error: ambiguous migrate command"
set +e
migrator --inherits tablename --inherits 'table name' migrate to up
migrator --inherits tablename --inherits 'table name' migrate to up >/tmp/migrator-arguments-2.out 2>&1
error_code=$?
set -e
@@ -25,3 +30,40 @@ elif [ "$error_code" != 2 ]; then
log error "test failed: ${WHITE}unexpected error code"
exit 1
fi
if ! grep -q 'ambiguous migrate subcommand' /tmp/migrator-arguments-2.out; then
log error "test failed: ${WHITE}missing ambiguous migrate diagnostic"
exit 1
fi
log notice "test case: ${WHITE}error: init invalid argument is logged"
set +e
migrator init --wat >/tmp/migrator-arguments-3.out 2>&1
error_code=$?
set -e
if [ "$error_code" != 9 ]; then
log error "test failed: ${WHITE}expected exit code 9 for invalid init argument, got $error_code"
exit 1
fi
if ! grep -q 'init argument .*--wat.* does not exists' /tmp/migrator-arguments-3.out; then
log error "test failed: ${WHITE}missing init invalid argument diagnostic"
exit 1
fi
log notice "test case: ${WHITE}error: list invalid argument is logged with correct command name"
set +e
migrator list --wat >/tmp/migrator-arguments-4.out 2>&1
error_code=$?
set -e
if [ "$error_code" != 9 ]; then
log error "test failed: ${WHITE}expected exit code 9 for invalid list argument, got $error_code"
exit 1
fi
if ! grep -q 'list argument .*--wat.* does not exists' /tmp/migrator-arguments-4.out; then
log error "test failed: ${WHITE}missing list invalid argument diagnostic"
exit 1
fi