From cc55c34f60ec955186dc1e911cbbcbdc20622b5a Mon Sep 17 00:00:00 2001 From: Florian Mirus Date: Thu, 10 Oct 2024 17:04:24 +0200 Subject: [PATCH] test updates --- .../test/test_docker_copy.py | 21 ++++++++++++++++--- .../test/test_docker_run.py | 13 ++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/test/scenario_execution_docker_test/test/test_docker_copy.py b/test/scenario_execution_docker_test/test/test_docker_copy.py index d1b21183..31855551 100644 --- a/test/scenario_execution_docker_test/test/test_docker_copy.py +++ b/test/scenario_execution_docker_test/test/test_docker_copy.py @@ -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') @@ -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()) \ No newline at end of file + 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()) + \ No newline at end of file diff --git a/test/scenario_execution_docker_test/test/test_docker_run.py b/test/scenario_execution_docker_test/test/test_docker_run.py index 74eac858..27ec1452 100644 --- a/test/scenario_execution_docker_test/test/test_docker_run.py +++ b/test/scenario_execution_docker_test/test/test_docker_run.py @@ -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())