From b1be2b4f186906b14a1e6bfa7357b7a8c1f2843b Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: May 16 2018 14:55:41 +0000 Subject: trivial tests improvements --- diff --git a/testing/functest_executor.py b/testing/functest_executor.py index 279b38c..a7c2a48 100644 --- a/testing/functest_executor.py +++ b/testing/functest_executor.py @@ -70,6 +70,7 @@ class TestExecutor(): def test_run_playbook_simple(self, monkeypatch): '''Execute a very simple playbook whether everything works''' + # don't override Ctrl+C during testing mock_signal = mock.Mock() monkeypatch.setattr(signal, 'signal', mock_signal) # it's non-default, but we can't run the test suite as root diff --git a/testing/test_executor.py b/testing/test_executor.py index 527c68f..0bd483f 100644 --- a/testing/test_executor.py +++ b/testing/test_executor.py @@ -138,9 +138,9 @@ class TestExecutor(): # must export ansible vars varsfile = os.path.join(self.artifactsdir.strpath, self.playbook_name, 'taskotron', 'task_vars.json') - varsfile_internal = os.path.join(self.artifactsdir.strpath, + allvarsfile = os.path.join(self.artifactsdir.strpath, self.playbook_name, 'taskotron', 'internal_vars.json') - for vf in [varsfile, varsfile_internal]: + for vf in [varsfile, allvarsfile]: assert os.path.isfile(vf) with open(vf, 'r') as f: json.load(f) @@ -150,7 +150,7 @@ class TestExecutor(): cmd_args = mock_popen.call_args[0][0] assert cmd_args[0] == 'ansible-playbook' assert '--inventory={},'.format(self.ipaddr) in cmd_args - assert '--extra-vars=@{}'.format(varsfile_internal) in cmd_args + assert '--extra-vars=@{}'.format(allvarsfile) in cmd_args assert '--become' in cmd_args assert '--connection=local' in cmd_args @@ -194,6 +194,7 @@ class TestExecutor(): def test_run_playbook_failsafe_error(self, monkeypatch): '''When failsafe stop gives an error, it should be ignored''' + # don't override Ctrl+C during testing mock_signal = mock.Mock() monkeypatch.setattr(signal, 'signal', mock_signal) error = exc.TaskotronInterruptError(15, 'SIGTERM') @@ -207,6 +208,7 @@ class TestExecutor(): def test_run_playbook_forwarded_vars(self, monkeypatch): '''Only certain vars should get forwarded to task playbook, no other''' + # don't override Ctrl+C during testing mock_signal = mock.Mock() monkeypatch.setattr(signal, 'signal', mock_signal) mock_popen = mock.Mock(return_value=('fake output', None))