Skip to content

Commit

Permalink
shell commands test fix, and make them neat please
Browse files Browse the repository at this point in the history
  • Loading branch information
omesser committed Jul 13, 2024
1 parent ebca8ed commit e3771b8
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tests/integration/cases/shell_commands/test_shell_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ def test_run_verify_md5(self):

# run twice to ensure md5 won't change between runs
for _ in range(2):
yield self._manof_command('run', ['--dummy', 'do', target_name])
yield self._execute_manof_command('run', ['--dummy', 'do', target_name])
command_sha = yield manof.utils.get_running_container_label(
target_name, label_name, self._logger
)
self.assertEqual('4a738101122b28baae05fac7a5dc6b32', command_sha)

run_md5, _, _ = yield self._manof_command(
run_md5, _, _ = yield self._execute_manof_command(
'run', ['--print-run-md5-only', '--dummy', 'do', target_name]
)
self.assertEqual('4a738101122b28baae05fac7a5dc6b32', run_md5)

# run again and make ensure md5 has changed due to "--dummy" value change
yield self._manof_command('run', ['--dummy', 'value', target_name])
yield self._execute_manof_command('run', ['--dummy', 'value', target_name])
command_sha = yield manof.utils.get_running_container_label(
target_name, label_name, self._logger
)
run_md5, _, _ = yield self._manof_command(
run_md5, _, _ = yield self._execute_manof_command(
'run', ['--print-run-md5-only', '--dummy', 'value', target_name]
)
self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', command_sha)
self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', run_md5)

# different dummy data yields different run md5
run_md5, _, _ = yield self._manof_command(
run_md5, _, _ = yield self._execute_manof_command(
'run', ['--print-run-md5-only', '--dummy', 'value2', target_name]
)
self.assertNotEqual(run_md5, command_sha)
Expand All @@ -62,30 +62,28 @@ def test_run_verify_md5(self):

# run twice to ensure md5 won't change between runs
for _ in range(2):
yield self._manof_command('run', ['--dummy', 'do', target_name])
yield self._execute_manof_command('run', ['--dummy', 'do', target_name])
command_sha = yield manof.utils.get_running_container_label(
target_name, label_name, self._logger
)
self.assertEqual('4a738101122b28baae05fac7a5dc6b32', command_sha)

run_md5, _, _ = yield self._manof_command(
run_md5, _, _ = yield self._execute_manof_command(
'run', ['--print-run-md5-only', '--dummy', 'do', target_name]
)
self.assertEqual('4a738101122b28baae05fac7a5dc6b32', run_md5)
self.assertEqual(command_sha, run_md5)

# run again and make ensure md5 has changed due to "--dummy" value change
yield self._manof_command('run', ['--dummy', 'else', target_name])
yield self._execute_manof_command('run', ['--dummy', 'else', target_name])
command_sha = yield manof.utils.get_running_container_label(
target_name, label_name, self._logger
)
run_md5, _, _ = yield self._manof_command(
run_md5, _, _ = yield self._execute_manof_command(
'run', ['--print-run-md5-only', '--dummy', 'else', target_name]
)
self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', command_sha)
self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', run_md5)
self.assertEqual(command_sha, run_md5)

# different dummy data yields different run md5
run_md5, _, _ = yield self._manof_command(
run_md5, _, _ = yield self._execute_manof_command(
'run', ['--print-run-md5-only', '--dummy', 'else2', target_name]
)
self.assertNotEqual(run_md5, command_sha)
Expand Down

0 comments on commit e3771b8

Please sign in to comment.