test: cover mixed valid-pair + orphan-file directory in native backup restore

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Marek Miklewicz
2026-07-05 16:58:47 +02:00
parent 6b7ec39025
commit ebddcd73bf
@@ -138,4 +138,25 @@ run_import scenario2 --user orphan --root "$TMP_DIR/backup_missing_conf" --overw
grep -q "SKIPPED orphan_db" "$TMP_DIR/scenario2.stdout" \ grep -q "SKIPPED orphan_db" "$TMP_DIR/scenario2.stdout" \
|| fail "expected orphan_db (no .conf) to be reported as SKIPPED, got: $(cat "$TMP_DIR/scenario2.stdout")" || fail "expected orphan_db (no .conf) to be reported as SKIPPED, got: $(cat "$TMP_DIR/scenario2.stdout")"
# --- Scenario 3: a mixed root (one valid pair + one orphan .sql) must report both correctly ---
mkdir -p "$TMP_DIR/backup_mixed"
cat > "$TMP_DIR/backup_mixed/mixed_good.conf" <<'EOF'
accesshosts=0=localhost
db_collation=DEFAULT_CHARACTER_SET_NAME=utf8mb4&DEFAULT_COLLATION_NAME=utf8mb4_unicode_ci&SCHEMA_NAME=mixed_good
mixed_good=accesshosts=localhost&select_priv=Y&passwd=%2Adef456&plugin=mysql_native_password
EOF
cat > "$TMP_DIR/backup_mixed/mixed_good.sql" <<'EOF'
CREATE TABLE t (id INT);
EOF
cat > "$TMP_DIR/backup_mixed/mixed_orphan.sql" <<'EOF'
CREATE TABLE t (id INT);
EOF
run_import scenario3 --user mixed --root "$TMP_DIR/backup_mixed" --overwrite allow
grep -q "IMPORTED mixed_good" "$TMP_DIR/scenario3.stdout" \
|| fail "expected mixed_good to be IMPORTED in a mixed root, got: $(cat "$TMP_DIR/scenario3.stdout")"
grep -q "SKIPPED mixed_orphan no-matching-conf" "$TMP_DIR/scenario3.stdout" \
|| fail "expected mixed_orphan (no .conf) to be SKIPPED in a mixed root alongside a valid pair, got: $(cat "$TMP_DIR/scenario3.stdout")"
echo "alt_mysql_native_backup_restore_import_test: OK" echo "alt_mysql_native_backup_restore_import_test: OK"