|
15 | 15 |
|
16 | 16 | from __future__ import absolute_import |
17 | 17 | import os |
| 18 | +import unittest |
18 | 19 | import uuid |
19 | 20 |
|
20 | 21 | import mock |
|
45 | 46 |
|
46 | 47 | __all__ = ["LocalShellCommandRunnerTestCase", "LocalShellScriptRunnerTestCase"] |
47 | 48 |
|
| 49 | +ST2_CI = os.environ.get("ST2_CI", "false").lower() == "true" |
| 50 | + |
48 | 51 | MOCK_EXECUTION = mock.Mock() |
49 | 52 | MOCK_EXECUTION.id = "598dbf0c0640fd54bffc688b" |
50 | 53 |
|
@@ -141,8 +144,13 @@ def test_common_st2_env_vars_are_available_to_the_action(self): |
141 | 144 | self.assertEqual(status, action_constants.LIVEACTION_STATUS_SUCCEEDED) |
142 | 145 | self.assertEqual(result["stdout"].strip(), "mock-token") |
143 | 146 |
|
| 147 | + # This test depends on passwordless sudo. Don't require that for local development. |
| 148 | + @unittest.skipIf( |
| 149 | + not ST2_CI, |
| 150 | + 'Skipping tests because ST2_CI environment variable is not set to "true"', |
| 151 | + ) |
144 | 152 | def test_sudo_and_env_variable_preservation(self): |
145 | | - # Verify that the environment environment are correctly preserved when running as a |
| 153 | + # Verify that the environment vars are correctly preserved when running as a |
146 | 154 | # root / non-system user |
147 | 155 | # Note: This test will fail if SETENV option is not present in the sudoers file |
148 | 156 | models = self.fixtures_loader.load_models( |
@@ -297,6 +305,11 @@ def test_action_stdout_and_stderr_is_stored_in_the_db_short_running_action( |
297 | 305 | self.assertEqual(output_dbs[db_index_1].data, mock_stderr[0]) |
298 | 306 | self.assertEqual(output_dbs[db_index_2].data, mock_stderr[1]) |
299 | 307 |
|
| 308 | + # This test depends on passwordless sudo. Don't require that for local development. |
| 309 | + @unittest.skipIf( |
| 310 | + not ST2_CI, |
| 311 | + 'Skipping tests because ST2_CI environment variable is not set to "true"', |
| 312 | + ) |
300 | 313 | def test_shell_command_sudo_password_is_passed_to_sudo_binary(self): |
301 | 314 | # Verify that sudo password is correctly passed to sudo binary via stdin |
302 | 315 | models = self.fixtures_loader.load_models( |
|
0 commit comments