@@ -51,11 +51,17 @@ def teardown_method(self):
5151 self .s2i_app .cleanup ()
5252
5353 def test_run_s2i_usage (self ):
54+ """
55+ Test checks if `usage` script works properly
56+ """
5457 output = self .s2i_app .s2i_usage ()
5558 assert output
5659
5760 # test_docker_run_usage
5861 def test_docker_run_usage (self ):
62+ """
63+ Test checks if `docker run` script works properly and do not fail
64+ """
5965 assert PodmanCLIWrapper .call_podman_command (
6066 cmd = f"run --rm { VARS .IMAGE_NAME } &>/dev/null" ,
6167 return_output = False
@@ -69,6 +75,10 @@ def test_docker_run_usage(self):
6975 ]
7076 )
7177 def test_run_app_test (self , container_arg ):
78+ """
79+ Test checks if we are able to run a container as deamon
80+ and response works as expected
81+ """
7282 cid_file_name = self .s2i_app .app_name
7383 assert self .s2i_app .create_container (cid_file_name = cid_file_name , container_args = container_arg )
7484 assert ContainerImage .wait_for_cid (cid_file_name = cid_file_name )
@@ -97,6 +107,11 @@ def test_run_app_test(self, container_arg):
97107)
98108class TestPerlExampleAppContainer :
99109 def test_run_app_test (self , application_path , container_args , page , expected_output ):
110+ """
111+ Test class checks specific applications
112+ and response works as expected. See parametrized parameters for more
113+ details
114+ """
100115 self .s2i_app = build_s2i_app (application_path , container_args = container_args )
101116 cid_file_name = self .s2i_app .app_name
102117 assert self .s2i_app .create_container (
@@ -128,6 +143,9 @@ def teardown_method(self):
128143 self .s2i_app .cleanup ()
129144
130145 def test_npm_works (self ):
146+ """
147+ Test checks if NPM works in container.
148+ """
131149 assert self .s2i_app .npm_works (image_name = VARS .IMAGE_NAME )
132150
133151
@@ -140,6 +158,10 @@ def test_npm_works(self):
140158)
141159class TestPerlHotDeployAppContainer :
142160 def test_run_app_test (self , application_path , container_args , hot_deploy ):
161+ """
162+ Test checks hot deploy application
163+ It checks what is present in HTTP response
164+ """
143165 self .s2i_app = build_s2i_app (application_path , container_args = container_args )
144166 cid_file_name = self .s2i_app .app_name
145167 assert self .s2i_app .create_container (
@@ -156,13 +178,19 @@ def test_run_app_test(self, application_path, container_args, hot_deploy):
156178 assert self .s2i_app .test_response (
157179 url = f"http://{ cip } " , expected_output = "old initial value: 1"
158180 )
159- sleep (2 )
181+ # We need to wait couple seconds till container
182+ # before changing 'string' in 'Test.pm' file
183+ # If we don't set PSGI_RELOAD, this change don't affects application.
184+ # If we set PSGI_RELOAD, this change affects application.
185+ sleep (3 )
160186 PodmanCLIWrapper .podman_exec_shell_command (
161187 cid_file_name = cid ,
162188 cmd = "sed -ie 's/old initial value/new initial value/' lib/My/Test.pm" ,
163189 used_shell = "/bin/sh"
164190 )
165191 if hot_deploy :
192+ # We need to wait couple seconds till container
193+ # does not update page. HotDeploy needs at least 3 seconds
166194 sleep (3 )
167195 assert PodmanCLIWrapper .podman_exec_shell_command (
168196 cid_file_name = cid ,
@@ -173,7 +201,6 @@ def test_run_app_test(self, application_path, container_args, hot_deploy):
173201 url = f"http://{ cip } " , expected_output = "new initial value: 0"
174202 )
175203 else :
176- sleep (2 )
177204 assert self .s2i_app .test_response (
178205 url = f"http://{ cip } " , expected_output = "old initial value: 2"
179206 )
0 commit comments