@@ -39,17 +39,17 @@ def teardown_method(self):
3939 """
4040 self .app_image .cleanup ()
4141
42- def test_s2i_usage (self ):
42+ def test_connection_without_mount (self ):
4343 """
4444 Test if MySQL container failed in case of invalid combinations.
4545 Steps are:
4646 1. Test if the container creation fails with invalid combinations of arguments
4747 2. Test if the container creation succeeds with valid combinations of arguments
4848 3. Test if the database connection works
4949 """
50- cid_config_build = "s2i_usage_build "
50+ cid_mount = "connection_without_mount "
5151 self .app_image .assert_container_creation_fails (
52- cid_file_name = cid_config_build ,
52+ cid_file_name = cid_mount ,
5353 command = "" ,
5454 container_args = [
5555 "-e MYSQL_USER=root" ,
@@ -58,24 +58,26 @@ def test_s2i_usage(self):
5858 "-e MYSQL_ROOT_PASSWORD=pass" ,
5959 ],
6060 )
61+ operation_user = "operations_user"
62+ operation_pass = "operations_pass"
6163 assert self .app_image .create_container (
62- cid_file_name = cid_config_build ,
64+ cid_file_name = cid_mount ,
6365 container_args = [
6466 "-e MYSQL_USER=config_test_user" ,
6567 "-e MYSQL_PASSWORD=config_test_user" ,
6668 "-e MYSQL_DATABASE=db" ,
67- "-e MYSQL_OPERATIONS_USER=operations_user " ,
68- "-e MYSQL_OPERATIONS_PASSWORD=operations_user " ,
69+ f "-e MYSQL_OPERATIONS_USER={ operation_user } " ,
70+ f "-e MYSQL_OPERATIONS_PASSWORD={ operation_pass } " ,
6971 ],
7072 )
71- cip , cid = self .app_image .get_cip_cid (cid_file_name = cid_config_build )
72- assert cip , cid
73+ cip , cid = self .app_image .get_cip_cid (cid_file_name = cid_mount )
74+ assert cip and cid
7375 assert self .app_image .test_db_connection (
74- container_ip = cip , username = "operations_user" , password = "operations_user"
76+ container_ip = cip , username = operation_user , password = operation_pass
7577 )
7678 PodmanCLIWrapper .call_podman_command (cmd = f"stop { cid } " )
7779
78- def test_s2i_usage_with_mount (self ):
80+ def test_connection_with_mount (self ):
7981 """
8082 Test if the MySQL container works properly with mounted application directory.
8183 Steps are:
@@ -84,30 +86,33 @@ def test_s2i_usage_with_mount(self):
8486 3. Test if the database connection works with the operations user
8587 """
8688 data_dir = tempfile .mkdtemp (prefix = "/tmp/mysql-test_data" )
87- shutil .copytree (VARS .TEST_DIR / "test-app" , f"{ data_dir } /test-app" )
89+ shutil .copytree (VARS .TEST_APP , f"{ data_dir } /test-app" )
8890 assert ContainerTestLibUtils .commands_to_run (
8991 commands_to_run = [
9092 f"chown -R 27:27 { data_dir } /test-app" ,
9193 ]
9294 )
93- cid_s2i_test_mount = "s2i_test_mount"
95+ cid_with_mount = "connection_with_mount"
96+ operation_user = "operations_user"
97+ operation_pass = "operations_pass"
98+
9499 self .app_image .create_container (
95- cid_file_name = cid_s2i_test_mount ,
100+ cid_file_name = cid_with_mount ,
96101 container_args = [
97102 "-e MYSQL_USER=config_test_user" ,
98103 "-e MYSQL_PASSWORD=config_test_user" ,
99104 "-e MYSQL_DATABASE=db" ,
100- "-e MYSQL_OPERATIONS_USER=operations_user " ,
101- "-e MYSQL_OPERATIONS_PASSWORD=operations_pass " ,
105+ f "-e MYSQL_OPERATIONS_USER={ operation_user } " ,
106+ f "-e MYSQL_OPERATIONS_PASSWORD={ operation_pass } " ,
102107 f"-v { data_dir } /test-app:/opt/app-root/src/:z" ,
103108 ],
104109 )
105- cip , cid = self .app_image .get_cip_cid (cid_file_name = cid_s2i_test_mount )
106- assert cip , cid
110+ cip , cid = self .app_image .get_cip_cid (cid_file_name = cid_with_mount )
111+ assert cip and cid
107112 assert self .app_image .test_db_connection (
108113 container_ip = cip ,
109- username = "operations_user" ,
110- password = "operations_pass" ,
114+ username = operation_user ,
115+ password = operation_pass ,
111116 max_attempts = 10 ,
112117 )
113118 PodmanCLIWrapper .call_podman_command (cmd = f"stop { cid } " )
0 commit comments