Skip to content

Commit 0a1b372

Browse files
committed
Rename port_to_expose to port.
1 parent f881c80 commit 0a1b372

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

clickhouse/testcontainers/clickhouse/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def __init__(self, image: str = "clickhouse/clickhouse-server:latest", port: int
4848
self.username = username or os.environ.get("CLICKHOUSE_USER", "test")
4949
self.password = password or os.environ.get("CLICKHOUSE_PASSWORD", "test")
5050
self.dbname = dbname or os.environ.get("CLICKHOUSE_DB", "test")
51-
self.port_to_expose = port
52-
self.with_exposed_ports(self.port_to_expose)
51+
self.port = port
52+
self.with_exposed_ports(self.port)
5353

5454
@wait_container_is_ready(Error, EOFError)
5555
def _connect(self) -> None:
@@ -68,5 +68,5 @@ def get_connection_url(self, host: Optional[str] = None) -> str:
6868
password=self.password,
6969
dbname=self.dbname,
7070
host=host,
71-
port=self.port_to_expose,
71+
port=self.port,
7272
)

elasticsearch/testcontainers/elasticsearch/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class ElasticSearchContainer(DockerContainer):
7777
def __init__(self, image: str = "elasticsearch", port: int = 9200, **kwargs) -> None:
7878
raise_for_deprecated_parameter(kwargs, "port_to_expose", "port")
7979
super(ElasticSearchContainer, self).__init__(image, **kwargs)
80-
self.port_to_expose = port
81-
self.with_exposed_ports(self.port_to_expose)
80+
self.port = port
81+
self.with_exposed_ports(self.port)
8282
self.with_env('transport.host', '127.0.0.1')
8383
self.with_env('http.host', '0.0.0.0')
8484

@@ -94,7 +94,7 @@ def _connect(self) -> None:
9494

9595
def get_url(self) -> str:
9696
host = self.get_container_host_ip()
97-
port = self.get_exposed_port(self.port_to_expose)
97+
port = self.get_exposed_port(self.port)
9898
return f'http://{host}:{port}'
9999

100100
def start(self) -> "ElasticSearchContainer":

keycloak/testcontainers/keycloak/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ def __init__(self, image="jboss/keycloak:latest", username: Optional[str] = None
3838
super(KeycloakContainer, self).__init__(image=image)
3939
self.username = username or os.environ.get("KEYCLOAK_USER", "test")
4040
self.password = password or os.environ.get("KEYCLOAK_PASSWORD", "test")
41-
self.port_to_expose = port
42-
self.with_exposed_ports(self.port_to_expose)
41+
self.port = port
42+
self.with_exposed_ports(self.port)
4343

4444
def _configure(self) -> None:
4545
self.with_env("KEYCLOAK_USER", self.username)
4646
self.with_env("KEYCLOAK_PASSWORD", self.password)
4747

4848
def get_url(self) -> str:
4949
host = self.get_container_host_ip()
50-
port = self.get_exposed_port(self.port_to_expose)
50+
port = self.get_exposed_port(self.port)
5151
return f"http://{host}:{port}"
5252

5353
@wait_container_is_ready(requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout)

mssql/testcontainers/mssql/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def __init__(self, image: str = "mcr.microsoft.com/mssql/server:2019-latest",
2727
raise_for_deprecated_parameter(kwargs, "user", "username")
2828
super(SqlServerContainer, self).__init__(image, **kwargs)
2929

30-
self.port_to_expose = port
31-
self.with_exposed_ports(self.port_to_expose)
30+
self.port = port
31+
self.with_exposed_ports(self.port)
3232

3333
self.password = password or environ.get("SQLSERVER_PASSWORD", "1Secure*Password1")
3434
self.username = username
@@ -44,5 +44,5 @@ def _configure(self) -> None:
4444
def get_connection_url(self) -> str:
4545
return super()._create_connection_url(
4646
dialect=self.dialect, username=self.username, password=self.password,
47-
dbname=self.dbname, port=self.port_to_expose
47+
dbname=self.dbname, port=self.port
4848
)

mysql/testcontainers/mysql/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def __init__(self, image: str = "mysql:latest", username: Optional[str] = None,
4747
raise_for_deprecated_parameter(kwargs, "MYSQL_DATABASE", "dbname")
4848
super(MySqlContainer, self).__init__(image, **kwargs)
4949

50-
self.port_to_expose = port
51-
self.with_exposed_ports(self.port_to_expose)
50+
self.port = port
51+
self.with_exposed_ports(self.port)
5252
self.username = username or environ.get('MYSQL_USER', 'test')
5353
self.root_password = root_password or environ.get('MYSQL_ROOT_PASSWORD', 'test')
5454
self.password = password or environ.get('MYSQL_PASSWORD', 'test')
@@ -70,4 +70,4 @@ def get_connection_url(self) -> str:
7070
username=self.username,
7171
password=self.password,
7272
dbname=self.dbname,
73-
port=self.port_to_expose)
73+
port=self.port)

postgres/testcontainers/postgres/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ def __init__(self, image: str = "postgres:latest", port: int = 5432,
4747
self.username = username or os.environ.get("POSTGRES_USER", "test")
4848
self.password = password or os.environ.get("POSTGRES_PASSWORD", "test")
4949
self.dbname = dbname or os.environ.get("POSTGRES_DB", "test")
50-
self.port_to_expose = port
50+
self.port = port
5151
self.driver = driver
5252

53-
self.with_exposed_ports(self.port_to_expose)
53+
self.with_exposed_ports(self.port)
5454

5555
def _configure(self) -> None:
5656
self.with_env("POSTGRES_USER", self.username)
@@ -61,5 +61,5 @@ def get_connection_url(self, host=None) -> str:
6161
return super()._create_connection_url(
6262
dialect=f"postgresql+{self.driver}", username=self.username,
6363
password=self.password, dbname=self.dbname, host=host,
64-
port=self.port_to_expose,
64+
port=self.port,
6565
)

redis/testcontainers/redis/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def __init__(self, image: str = "redis:latest", port: int = 6379,
3535
password: Optional[str] = None, **kwargs) -> None:
3636
raise_for_deprecated_parameter(kwargs, "port_to_expose", "port")
3737
super(RedisContainer, self).__init__(image, **kwargs)
38-
self.port_to_expose = port
38+
self.port = port
3939
self.password = password
40-
self.with_exposed_ports(self.port_to_expose)
40+
self.with_exposed_ports(self.port)
4141
if self.password:
4242
self.with_command(f"redis-server --requirepass {self.password}")
4343

@@ -59,7 +59,7 @@ def get_client(self, **kwargs) -> redis.Redis:
5959
"""
6060
return redis.Redis(
6161
host=self.get_container_host_ip(),
62-
port=self.get_exposed_port(self.port_to_expose),
62+
port=self.get_exposed_port(self.port),
6363
password=self.password,
6464
**kwargs,
6565
)

0 commit comments

Comments
 (0)