mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Update old tests.
This commit is contained in:
@@ -319,19 +319,19 @@ class RunAdHocCommandTest(BaseAdHocCommandTest):
|
|||||||
self.assertIn('ssh-agent', ad_hoc_command.job_args)
|
self.assertIn('ssh-agent', ad_hoc_command.job_args)
|
||||||
self.assertNotIn('Bad passphrase', ad_hoc_command.result_stdout)
|
self.assertNotIn('Bad passphrase', ad_hoc_command.result_stdout)
|
||||||
|
|
||||||
def test_run_with_proot(self):
|
def test_run_with_bubblewrap(self):
|
||||||
# Only run test if proot is installed
|
# Only run test if bubblewrap is installed
|
||||||
cmd = [getattr(settings, 'AWX_PROOT_CMD', 'proot'), '--version']
|
cmd = [getattr(settings, 'AWX_PROOT_CMD', 'bwrap'), '--version']
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
proc.communicate()
|
proc.communicate()
|
||||||
has_proot = bool(proc.returncode == 0)
|
has_bubblewrap = bool(proc.returncode == 0)
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
has_proot = False
|
has_bubblewrap = False
|
||||||
if not has_proot:
|
if not has_bubblewrap:
|
||||||
self.skipTest('proot is not installed')
|
self.skipTest('bubblewrap is not installed')
|
||||||
# Enable proot for this test.
|
# Enable bubblewrap for this test.
|
||||||
settings.AWX_PROOT_ENABLED = True
|
settings.AWX_PROOT_ENABLED = True
|
||||||
# Hide local settings path.
|
# Hide local settings path.
|
||||||
settings.AWX_PROOT_HIDE_PATHS = [os.path.join(settings.BASE_DIR, 'settings')]
|
settings.AWX_PROOT_HIDE_PATHS = [os.path.join(settings.BASE_DIR, 'settings')]
|
||||||
@@ -362,8 +362,8 @@ class RunAdHocCommandTest(BaseAdHocCommandTest):
|
|||||||
self.check_ad_hoc_command_events(ad_hoc_command, 'ok')
|
self.check_ad_hoc_command_events(ad_hoc_command, 'ok')
|
||||||
|
|
||||||
@mock.patch('awx.main.tasks.BaseTask.run_pexpect', return_value=('failed', 0))
|
@mock.patch('awx.main.tasks.BaseTask.run_pexpect', return_value=('failed', 0))
|
||||||
def test_run_with_proot_not_installed(self, ignore):
|
def test_run_with_bubblewrap_not_installed(self, ignore):
|
||||||
# Enable proot for this test, specify invalid proot cmd.
|
# Enable bubblewrap for this test, specify invalid bubblewrap cmd.
|
||||||
settings.AWX_PROOT_ENABLED = True
|
settings.AWX_PROOT_ENABLED = True
|
||||||
settings.AWX_PROOT_CMD = 'PR00T'
|
settings.AWX_PROOT_CMD = 'PR00T'
|
||||||
ad_hoc_command = self.create_test_ad_hoc_command()
|
ad_hoc_command = self.create_test_ad_hoc_command()
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ TEST_ASYNC_NOWAIT_PLAYBOOK = '''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
TEST_PROOT_PLAYBOOK = '''
|
TEST_PROOT_PLAYBOOK = '''
|
||||||
- name: test proot environment
|
- name: test bubblewrap environment
|
||||||
hosts: test-group
|
hosts: test-group
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
connection: local
|
connection: local
|
||||||
@@ -1177,19 +1177,19 @@ class RunJobTest(BaseJobExecutionTest):
|
|||||||
|
|
||||||
@unittest.skipUnless(settings.BROKER_URL == 'redis://localhost/',
|
@unittest.skipUnless(settings.BROKER_URL == 'redis://localhost/',
|
||||||
'Non-default Redis setup.')
|
'Non-default Redis setup.')
|
||||||
def test_run_job_with_proot(self):
|
def test_run_job_with_bubblewrap(self):
|
||||||
# Only run test if proot is installed
|
# Only run test if bubblewrap is installed
|
||||||
cmd = [getattr(settings, 'AWX_PROOT_CMD', 'proot'), '--version']
|
cmd = [getattr(settings, 'AWX_PROOT_CMD', 'bwrap'), '--version']
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
proc.communicate()
|
proc.communicate()
|
||||||
has_proot = bool(proc.returncode == 0)
|
has_bubblewrap = bool(proc.returncode == 0)
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
has_proot = False
|
has_bubblewrap = False
|
||||||
if not has_proot:
|
if not has_bubblewrap:
|
||||||
self.skipTest('proot is not installed')
|
self.skipTest('bubblewrap is not installed')
|
||||||
# Enable proot for this test.
|
# Enable bubblewrap for this test.
|
||||||
settings.AWX_PROOT_ENABLED = True
|
settings.AWX_PROOT_ENABLED = True
|
||||||
# Hide local settings path.
|
# Hide local settings path.
|
||||||
settings.AWX_PROOT_HIDE_PATHS = [os.path.join(settings.BASE_DIR, 'settings')]
|
settings.AWX_PROOT_HIDE_PATHS = [os.path.join(settings.BASE_DIR, 'settings')]
|
||||||
@@ -1227,8 +1227,8 @@ class RunJobTest(BaseJobExecutionTest):
|
|||||||
job = Job.objects.get(pk=job.pk)
|
job = Job.objects.get(pk=job.pk)
|
||||||
self.check_job_result(job, 'successful')
|
self.check_job_result(job, 'successful')
|
||||||
|
|
||||||
def test_run_job_with_proot_not_installed(self):
|
def test_run_job_with_bubblewrap_not_installed(self):
|
||||||
# Enable proot for this test, specify invalid proot cmd.
|
# Enable bubblewrap for this test, specify invalid bubblewrap cmd.
|
||||||
settings.AWX_PROOT_ENABLED = True
|
settings.AWX_PROOT_ENABLED = True
|
||||||
settings.AWX_PROOT_CMD = 'PR00T'
|
settings.AWX_PROOT_CMD = 'PR00T'
|
||||||
self.create_test_credential()
|
self.create_test_credential()
|
||||||
|
|||||||
Reference in New Issue
Block a user