This repository was archived by the owner on Jun 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 5959 ⌛️ [running Python SDK tests](${{ env.RUN_URL }})...
6060 - run : poetry install
6161 - run : poetry run pytest -s
62+ env :
63+ TC_HOST : 172.17.0.1
6264 - name : Comment on failure
6365 if : ${{ github.event.inputs.prNumber && failure() }}
6466 uses : marocchino/sticky-pull-request-comment@v2
Original file line number Diff line number Diff line change @@ -28,22 +28,28 @@ class SeamBackend:
2828@pytest .fixture (scope = "function" )
2929def seam_backend ():
3030 with PostgresContainer ("postgres:13" , dbname = "postgres" ) as pg :
31- db_host = (
32- "host.docker.internal"
33- if sys .platform == "darwin"
34- else "172.17.0.1"
35- )
36- db_url = f"postgresql://test:test@{ db_host } :{ pg .get_exposed_port (pg .port_to_expose )} /postgres"
31+ db_host = pg .get_container_host_ip ()
32+ db_url = pg .get_connection_url ()
33+
34+ # UPSTREAM: https://github.com/testcontainers/testcontainers-python/issues/159
35+ docker_info = pg .get_docker_client ().client .info ()
36+ if docker_info ["OperatingSystem" ] == "Docker Desktop" :
37+ container_host = "host.docker.internal"
38+ db_url = db_url .replace (db_host , container_host )
39+ db_host = container_host
40+
3741 with DockerContainer (
3842 os .environ .get (
3943 "SEAM_CONNECT_IMAGE" , "ghcr.io/seamapi/seam-connect"
4044 )
41- ).with_env ("DATABASE_URL" , db_url ,).with_env (
45+ ).with_env (
46+ "DATABASE_URL" , db_url
47+ ).with_env (
4248 "POSTGRES_DATABASE" , "postgres"
4349 ).with_env (
4450 "NODE_ENV" , "test"
4551 ).with_env (
46- "POSTGRES_HOST" , db_host
52+ "POSTGRES_HOST" , db_host ,
4753 ).with_env (
4854 "SERVER_BASE_URL" , "http://localhost:3020"
4955 ).with_env (
You can’t perform that action at this time.
0 commit comments