@@ -175,19 +175,20 @@ def test_logrotate(tt_cmd, tmpdir_with_cfg):
175
175
assert instance_process_rc == 0
176
176
177
177
178
- def assert_file_cleaned (filepath , cmd_out ):
178
+ def assert_file_cleaned (filepath , instance_name , cmd_out ):
179
179
# https://github.com/tarantool/tt/issues/735
180
- assert len (re .findall (r"• " + str ( filepath ) , cmd_out )) == 1
180
+ assert len (re .findall (r"• " + instance_name , cmd_out )) == 1
181
181
assert os .path .exists (filepath ) is False
182
182
183
183
184
184
def test_clean (tt_cmd , tmpdir_with_cfg ):
185
185
tmpdir = tmpdir_with_cfg
186
- test_app_path = os .path .join (os .path .dirname (__file__ ), "test_data_app" , "test_data_app.lua" )
186
+ app_name = "test_data_app"
187
+ test_app_path = os .path .join (os .path .dirname (__file__ ), app_name , "test_data_app.lua" )
187
188
shutil .copy (test_app_path , tmpdir )
188
189
189
190
# Start an instance.
190
- start_cmd = [tt_cmd , "start" , "test_data_app" ]
191
+ start_cmd = [tt_cmd , "start" , app_name ]
191
192
instance_process = subprocess .Popen (
192
193
start_cmd ,
193
194
cwd = tmpdir ,
@@ -199,9 +200,9 @@ def test_clean(tt_cmd, tmpdir_with_cfg):
199
200
assert re .search (r"Starting an instance" , start_output )
200
201
201
202
# Wait until application is ready.
202
- lib_dir = os .path .join (tmpdir , "test_data_app" , lib_path , "test_data_app" )
203
- run_dir = os .path .join (tmpdir , "test_data_app" , run_path , "test_data_app" )
204
- log_dir = os .path .join (tmpdir , "test_data_app" , log_path , "test_data_app" )
203
+ lib_dir = os .path .join (tmpdir , app_name , lib_path , app_name )
204
+ run_dir = os .path .join (tmpdir , app_name , run_path , app_name )
205
+ log_dir = os .path .join (tmpdir , app_name , log_path , app_name )
205
206
206
207
file = wait_file (lib_dir , initial_snap , [])
207
208
assert file != ""
@@ -216,13 +217,13 @@ def test_clean(tt_cmd, tmpdir_with_cfg):
216
217
assert file != ""
217
218
218
219
# Check that clean warns about application is running.
219
- clean_cmd = [tt_cmd , "clean" , "test_data_app" , "--force" ]
220
+ clean_cmd = [tt_cmd , "clean" , app_name , "--force" ]
220
221
clean_rc , clean_out = run_command_and_get_output (clean_cmd , cwd = tmpdir )
221
222
assert clean_rc == 0
222
223
assert re .search (r"instance `test_data_app` must be stopped" , clean_out )
223
224
224
225
# Stop the Instance.
225
- stop_cmd = [tt_cmd , "stop" , "-y" , "test_data_app" ]
226
+ stop_cmd = [tt_cmd , "stop" , "-y" , app_name ]
226
227
stop_rc , stop_out = run_command_and_get_output (stop_cmd , cwd = tmpdir )
227
228
assert stop_rc == 0
228
229
assert re .search (r"The Instance test_data_app \(PID = \d+\) has been terminated\." , stop_out )
@@ -236,9 +237,9 @@ def test_clean(tt_cmd, tmpdir_with_cfg):
236
237
assert clean_rc == 0
237
238
assert re .search (r"\[ERR\]" , clean_out ) is None
238
239
239
- assert_file_cleaned (os .path .join (log_dir , log_file ), clean_out )
240
- assert_file_cleaned (os .path .join (lib_dir , initial_snap ), clean_out )
241
- assert_file_cleaned (os .path .join (lib_dir , initial_xlog ), clean_out )
240
+ assert_file_cleaned (os .path .join (log_dir , log_file ), app_name , clean_out )
241
+ assert_file_cleaned (os .path .join (lib_dir , initial_snap ), app_name , clean_out )
242
+ assert_file_cleaned (os .path .join (lib_dir , initial_xlog ), app_name , clean_out )
242
243
243
244
244
245
def test_running_base_functionality_working_dir_app (tt_cmd ):
0 commit comments