Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed Feb 16, 2025
1 parent 2f79344 commit 3e0c6c2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
35 changes: 16 additions & 19 deletions testcontainers/iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,33 @@ def __init__(
self.with_exposed_ports(self.port)

def _configure(self) -> None:
self.with_env("IRIS_USERNAME", self.username)
self.with_env("IRIS_PASSWORD", self.password)
self.with_env("IRIS_NAMESPACE", self.namespace)
# self.with_env("IRIS_USERNAME", self.username)
# self.with_env("IRIS_PASSWORD", self.password)
# self.with_env("IRIS_NAMESPACE", self.namespace)
if self.license_key:
self.with_volume_mapping(
self.license_key, "/usr/irissys/mgr/iris.key", "ro"
)

def _connect(self) -> None:
wait_for_logs(self, predicate="Enabling logons")
if self.image.startswith("intersystemsdc"):
wait_for_logs(self, predicate="executed command")
else:
if self.namespace.upper() != "USER":
cmd = (
f"iris session iris -U %%SYS '##class(%%SQL.Statement).%%ExecDirect(,\"CREATE DATABASE %s\")'"
% (self.namespace,)
)
self.exec(cmd)
if self.namespace.upper() != "USER":
cmd = (
f'iris session iris -U %%SYS \'##class(Security.Users).Create("%s","%s","%s",,"%s")\''
% (
self.username,
"%ALL",
self.password,
self.namespace,
)
f"iris session iris -U %%SYS '##class(%%SQL.Statement).%%ExecDirect(,\"CREATE DATABASE %s\")'"
% (self.namespace,)
)
res = self.exec(cmd)
print("res", cmd, res)
cmd = (
f'iris session iris -U %%SYS \'##class(Security.Users).Create("%s","%s","%s")\''
% (
self.username,
"%ALL",
self.password,
)
)
res = self.exec(cmd)
print("res", cmd, res)

def get_connection_url(self, host=None) -> str:
return super()._create_connection_url(
Expand Down
10 changes: 8 additions & 2 deletions tests/test_iris.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ def check_connection(iris):


def test_community():
iris_container = IRISContainer("intersystemsdc/iris-community:2023.1.1.380.0-zpm", **creds)
iris_container = IRISContainer("containers.intersystems.com/intersystems/iris-community:latest-em", **creds)
with iris_container as iris:
check_connection(iris)


def test_dccommunity():
iris_container = IRISContainer("intersystemsdc/iris-community:latest", **creds)
with iris_container as iris:
check_connection(iris)


def test_enterprise():
license_key = os.path.abspath(os.path.expanduser("~/iris.key"))
iris_container = IRISContainer("containers.intersystems.com/intersystems/iris:2023.3", license_key=license_key,
iris_container = IRISContainer("containers.intersystems.com/intersystems/iris:latest-cd", license_key=license_key,
**creds)
with iris_container as iris:
check_connection(iris)

0 comments on commit 3e0c6c2

Please sign in to comment.