Build isolated upgrade URL from runtime config
This commit is contained in:
@@ -94,8 +94,10 @@ def test_upgrade_smoke_restores_and_upgrades_only_an_isolated_database() -> None
|
|||||||
assert "restore_release_backup_smoke.sh" in script
|
assert "restore_release_backup_smoke.sh" in script
|
||||||
assert "--keep-database" in script
|
assert "--keep-database" in script
|
||||||
assert "geointel_restore_verify_" in script
|
assert "geointel_restore_verify_" in script
|
||||||
assert 'make_url(os.environ["DATABASE_URL"])' in script
|
assert "from sqlalchemy import URL" in script
|
||||||
assert ".set(database=os.environ[\"TARGET_DB\"])" in script
|
assert 'username=os.environ["GEOINTEL_POSTGRES_USER"]' in script
|
||||||
|
assert 'password=os.environ["GEOINTEL_POSTGRES_PASSWORD"]' in script
|
||||||
|
assert 'database=os.environ["TARGET_DB"]' in script
|
||||||
assert '"$CONTAINER" sh -c' in script
|
assert '"$CONTAINER" sh -c' in script
|
||||||
assert '"$CONTAINER" sh -lc' not in script
|
assert '"$CONTAINER" sh -lc' not in script
|
||||||
assert "python -m alembic upgrade head" in script
|
assert "python -m alembic upgrade head" in script
|
||||||
|
|||||||
@@ -76,11 +76,17 @@ fi
|
|||||||
docker exec -e TARGET_DB="$TARGET_DB" "$CONTAINER" sh -c '
|
docker exec -e TARGET_DB="$TARGET_DB" "$CONTAINER" sh -c '
|
||||||
target_url="$(python -c '"'"'
|
target_url="$(python -c '"'"'
|
||||||
import os
|
import os
|
||||||
from sqlalchemy.engine import make_url
|
from sqlalchemy import URL
|
||||||
|
|
||||||
print(
|
print(
|
||||||
make_url(os.environ["DATABASE_URL"])
|
URL.create(
|
||||||
.set(database=os.environ["TARGET_DB"])
|
"postgresql+psycopg",
|
||||||
|
username=os.environ["GEOINTEL_POSTGRES_USER"],
|
||||||
|
password=os.environ["GEOINTEL_POSTGRES_PASSWORD"],
|
||||||
|
host="127.0.0.1",
|
||||||
|
port=5432,
|
||||||
|
database=os.environ["TARGET_DB"],
|
||||||
|
)
|
||||||
.render_as_string(hide_password=False)
|
.render_as_string(hide_password=False)
|
||||||
)
|
)
|
||||||
'"'"')"
|
'"'"')"
|
||||||
|
|||||||
Reference in New Issue
Block a user