Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
fmirus committed Oct 10, 2024
1 parent 5963396 commit cc55c34
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
21 changes: 18 additions & 3 deletions test/scenario_execution_docker_test/test/test_docker_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def test_success(self):
import osc.os
scenario test_success:
timeout(25s)
timeout(10)
do parallel:
docker_run(image: 'ubuntu', command: 'sleep 20', detach: true, container_name: 'sleeping_beauty', remove: true)
docker_run(image: 'ubuntu', command: 'sleep 5', detach: true, container_name: 'sleeping_beauty', remove: true)
serial:
docker_exec(container: 'sleeping_beauty', command: 'mkdir -p /tmp/test_dir/')
docker_exec(container: 'sleeping_beauty', command: 'touch /tmp/test_dir/test.txt')
Expand All @@ -65,4 +65,19 @@ def test_success(self):
check_file_exists(file_name: '""" + self.tmp_dir.name + '/test_dir/test_1.txt' + """')
emit end
""")
self.assertTrue(self.scenario_execution.process_results())
self.assertTrue(self.scenario_execution.process_results())

def test_failure_missing_file(self):
self.parse("""
import osc.docker
import osc.helpers
scenario test_success:
timeout(10s)
do parallel:
docker_run(image: 'ubuntu', command: 'sleep 5', detach: true, container_name: 'sleeping_beauty1', remove: true)
serial:
docker_copy(container: 'sleeping_beauty1', file_path: '/tmp/test_dir/')
""")
self.assertFalse(self.scenario_execution.process_results())

13 changes: 13 additions & 0 deletions test/scenario_execution_docker_test/test/test_docker_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,16 @@ def test_success_detach(self):
emit end
""")
self.assertTrue(self.scenario_execution.process_results())

def test_fail_unknown_command(self):
self.parse("""
import osc.docker
import osc.helpers
scenario test:
timeout(10s)
do serial:
docker_run(image: 'ubuntu', command: 'UKNOWN', detach: true)
emit end
""")
self.assertFalse(self.scenario_execution.process_results())

0 comments on commit cc55c34

Please sign in to comment.