Skip to content

Commit

Permalink
Merge pull request #378 from SUSE/mariadb_client_tests
Browse files Browse the repository at this point in the history
Start of mariadb-client image tests
  • Loading branch information
dcermak authored Jan 10, 2024
2 parents 9580c5d + 9538deb commit 2a6d5e2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,18 +563,30 @@ def create_BCI(
create_BCI(
build_tag=f"{APP_CONTAINER_PREFIX}/mariadb:{mariadb_ver}",
bci_type=ImageType.APPLICATION,
available_versions=maria_versions,
available_versions=os_versions,
forwarded_ports=[PortForwarding(container_port=3306)],
extra_environment_variables={
"MARIADB_ROOT_PASSWORD": MARIADB_ROOT_PASSWORD
},
)
for mariadb_ver, maria_versions in (
for mariadb_ver, os_versions in (
("10.6", ("15.5", "15.6")),
("11.2", ("tumbleweed",)),
)
]

MARIADB_CLIENT_CONTAINERS = [
create_BCI(
build_tag=f"{APP_CONTAINER_PREFIX}/mariadb-client:{mariadb_client_ver}",
bci_type=ImageType.APPLICATION,
available_versions=os_versions,
custom_entry_point="/bin/sh",
)
for mariadb_client_ver, os_versions in (
("10.6", ("15.5", "15.6")),
("11.2", ("tumbleweed",)),
)
]

POSTGRES_PASSWORD = "n0ts3cr3t"

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ markers = [
'golang_stable-openssl',
'mariadb_10.6',
'mariadb_11.2',
'mariadb-client_10.6',
'mariadb-client_11.2',
'nodejs_16',
'nodejs_18',
'nodejs_20',
Expand Down
12 changes: 12 additions & 0 deletions tests/test_mariadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from tenacity import stop_after_attempt
from tenacity import wait_exponential

from bci_tester.data import MARIADB_CLIENT_CONTAINERS
from bci_tester.data import MARIADB_CONTAINERS
from bci_tester.data import MARIADB_ROOT_PASSWORD

Expand Down Expand Up @@ -136,3 +137,14 @@ def wait_for_db_to_start():
with conn.cursor() as cur:
cur.execute("SELECT * FROM test;")
assert cur.fetchone() == (1, 100, "abc'def")


@pytest.mark.parametrize(
"container_per_test",
MARIADB_CLIENT_CONTAINERS,
indirect=["container_per_test"],
)
def test_mariadb_client(container_per_test: ContainerData) -> None:
assert "MariaDB" in container_per_test.connection.check_output(
"mysql --version"
)

0 comments on commit 2a6d5e2

Please sign in to comment.