Skip to content

Commit

Permalink
Fix the feature
Browse files Browse the repository at this point in the history
Stop waiting for connection, which requires ready container.
Instead copy data first thing.
  • Loading branch information
Jb DOYON committed Apr 26, 2024
1 parent ac0fc34 commit 8a79bd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/testcontainers/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def _create_connection_url(
def start(self) -> "DbContainer":
self._configure()
super().start()
self._connect()
self._transfer_seed()
self._connect()
return self

def _configure(self) -> None:
Expand Down
5 changes: 3 additions & 2 deletions modules/mysql/testcontainers/mysql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ def __init__(

if self.username == "root":
self.root_password = self.password
if seed is not None:
self.seed = seed
self.seed = seed

def _configure(self) -> None:
self.with_env("MYSQL_ROOT_PASSWORD", self.root_password)
Expand All @@ -110,6 +109,8 @@ def get_connection_url(self) -> str:
)

def _transfer_seed(self) -> None:
if self.seed is None:
return
src_path = Path(self.seed)
dest_path = "/docker-entrypoint-initdb.d/"
with BytesIO() as archive, tarfile.TarFile(fileobj=archive, mode="w") as tar:
Expand Down

0 comments on commit 8a79bd3

Please sign in to comment.