Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Co-Authored-By: Alex Schultz <aschultz@redhat.com> Change-Id: I642a46b31586f2791c510645f475effd52ce304e
This commit is contained in:
parent
afbd091df9
commit
5084da8196
test-requirements.txt
tripleoclient/tests
fakes.pytest_export.pytest_heat_launcher.pytest_overcloud_credentials.pytest_plugin.pytest_utils.py
v1
baremetal
overcloud_backup
overcloud_config
overcloud_deploy
overcloud_external_update
overcloud_external_upgrade
overcloud_image
overcloud_netenv_validate
overcloud_node
overcloud_roles
overcloud_update
overcloud_upgrade
test_container_image.pytest_overcloud_admin.pytest_overcloud_bios.pytest_overcloud_export.pytest_overcloud_export_ceph.pytest_overcloud_parameters.pytest_overcloud_profiles.pytest_overcloud_raid.pytest_plugin.pytest_tripleo_config.pytest_tripleo_validator.pytripleo
undercloud
v2
container_image
overcloud_ceph
overcloud_delete
overcloud_network
overcloud_node
overcloud_support
workflows
@ -4,7 +4,6 @@
|
|||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
docutils>=0.11 # OSI-Approved Open Source, Public Domain
|
docutils>=0.11 # OSI-Approved Open Source, Public Domain
|
||||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||||
mock>=3.0.0 # BSD
|
|
||||||
stestr>=2.0.0 # Apache-2.0
|
stestr>=2.0.0 # Apache-2.0
|
||||||
testtools>=2.2.0 # MIT
|
testtools>=2.2.0 # MIT
|
||||||
requests-mock>=1.2.0 # Apache-2.0
|
requests-mock>=1.2.0 # Apache-2.0
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import mock
|
|
||||||
import sys
|
import sys
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from tripleoclient import export
|
from tripleoclient import export
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient import heat_launcher
|
from tripleoclient import heat_launcher
|
||||||
from tripleoclient.exceptions import HeatPodMessageQueueException
|
from tripleoclient.exceptions import HeatPodMessageQueueException
|
||||||
@ -47,13 +47,6 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
use_tmp_dir=False,
|
use_tmp_dir=False,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
def check_calls(self, check_call, mock_obj):
|
|
||||||
for call in mock_obj.call_args_list:
|
|
||||||
call_str = ' '.join(call.args[0])
|
|
||||||
if check_call in call_str:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def test_rm_heat_launcher(self):
|
def test_rm_heat_launcher(self):
|
||||||
self.assertIsInstance(self.get_launcher(rm_heat=True),
|
self.assertIsInstance(self.get_launcher(rm_heat=True),
|
||||||
heat_launcher.HeatPodLauncher)
|
heat_launcher.HeatPodLauncher)
|
||||||
@ -61,49 +54,58 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
def test_chcon(self):
|
def test_chcon(self):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
launcher._chcon()
|
launcher._chcon()
|
||||||
self.check_calls('chcon', self.check_call)
|
calls = [
|
||||||
self.check_calls(launcher.heat_dir, self.check_call)
|
mock.call(['chcon', '-R', '-t', 'container_file_t', '-l', 's0',
|
||||||
|
launcher.heat_dir]),
|
||||||
|
mock.call(['chcon', '-R', '-t', 'container_file_t', '-l', 's0',
|
||||||
|
launcher.heat_dir])
|
||||||
|
]
|
||||||
|
self.assertEqual(self.check_call.mock_calls, calls)
|
||||||
|
|
||||||
def test_fetch_container_image(self):
|
def test_fetch_container_image(self):
|
||||||
launcher = self.get_launcher(skip_heat_pull=True)
|
launcher = self.get_launcher(skip_heat_pull=True)
|
||||||
|
self.check_output.reset_mock()
|
||||||
launcher._fetch_container_image()
|
launcher._fetch_container_image()
|
||||||
self.assertFalse(self.check_calls('podman pull', self.check_output))
|
self.check_output.assert_not_called()
|
||||||
|
|
||||||
launcher = self.get_launcher(skip_heat_pull=False)
|
launcher = self.get_launcher(skip_heat_pull=False)
|
||||||
launcher._fetch_container_image()
|
launcher._fetch_container_image()
|
||||||
self.assertTrue(self.check_calls('podman pull', self.check_output))
|
self.check_output.assert_called_with(['sudo', 'podman', 'pull',
|
||||||
|
mock.ANY])
|
||||||
|
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
||||||
def test_get_pod_state(self, mock_decode):
|
def test_get_pod_state(self, mock_decode):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
launcher.get_pod_state()
|
launcher.get_pod_state()
|
||||||
self.check_calls('podman pod inspect', self.run)
|
self.run.assert_called_once_with(
|
||||||
self.assertTrue(mock_decode.called)
|
['sudo', 'podman', 'pod', 'inspect', '--format', '"{{.State}}"',
|
||||||
|
'ephemeral-heat'], check=False, stderr=-2, stdout=-1)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
'tripleoclient.heat_launcher.HeatPodLauncher._write_heat_config')
|
'tripleoclient.heat_launcher.HeatPodLauncher._write_heat_config')
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._write_heat_pod')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._write_heat_pod')
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.get_pod_state')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.get_pod_state')
|
||||||
def test_lauch_heat(
|
def test_launch_heat(
|
||||||
self, mock_get_pod_state, mock_write_heat_pod,
|
self, mock_get_pod_state, mock_write_heat_pod,
|
||||||
mock_write_heat_config):
|
mock_write_heat_config):
|
||||||
|
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_call.reset_mock()
|
||||||
|
|
||||||
mock_get_pod_state.return_value = 'Running'
|
mock_get_pod_state.return_value = 'Running'
|
||||||
launcher.launch_heat()
|
launcher.launch_heat()
|
||||||
self.assertFalse(mock_write_heat_pod.called)
|
self.check_call.assert_not_called()
|
||||||
self.assertFalse(self.check_calls('podman play kube', self.check_call))
|
|
||||||
|
|
||||||
mock_get_pod_state.return_value = 'Exited'
|
mock_get_pod_state.return_value = 'Exited'
|
||||||
launcher.launch_heat()
|
launcher.launch_heat()
|
||||||
self.assertTrue(mock_write_heat_pod.called)
|
self.check_call.assert_called_once_with(['sudo', 'podman', 'play',
|
||||||
self.assertTrue(self.check_calls('podman play kube', self.check_call))
|
'kube', mock.ANY])
|
||||||
|
self.check_call.reset_mock()
|
||||||
|
|
||||||
mock_get_pod_state.return_value = ''
|
mock_get_pod_state.return_value = ''
|
||||||
launcher.launch_heat()
|
launcher.launch_heat()
|
||||||
self.assertTrue(mock_write_heat_pod.called)
|
self.check_call.assert_called_once_with(['sudo', 'podman', 'play',
|
||||||
self.assertTrue(self.check_calls('podman play kube', self.check_call))
|
'kube', mock.ANY])
|
||||||
|
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.do_restore_db')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.do_restore_db')
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.database_exists')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.database_exists')
|
||||||
@ -113,43 +115,72 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
mock_db_exists.return_value = True
|
mock_db_exists.return_value = True
|
||||||
launcher.heat_db_sync(restore_db=False)
|
launcher.heat_db_sync(restore_db=False)
|
||||||
self.assertFalse(self.check_calls('create database', self.check_call))
|
calls = [
|
||||||
self.assertFalse(self.check_calls('create user', self.check_call))
|
mock.call(['chcon', '-R', '-t', 'container_file_t', '-l', 's0',
|
||||||
self.assertFalse(self.check_calls('grant all', self.check_call))
|
mock.ANY]),
|
||||||
self.assertFalse(self.check_calls('flush priv', self.check_call))
|
mock.call(['sudo', 'podman', 'run', '--rm', '--user', 'heat',
|
||||||
self.assertTrue(self.check_calls('heat-manage', self.check_call))
|
'--volume', mock.ANY, '--volume', mock.ANY,
|
||||||
|
'quay.io/tripleomaster/openstack-heat-api:current-'
|
||||||
|
'tripleo',
|
||||||
|
'heat-manage', 'db_sync'])
|
||||||
|
]
|
||||||
|
self.assertEqual(self.check_call.mock_calls, calls)
|
||||||
self.assertFalse(mock_do_restore_db.called)
|
self.assertFalse(mock_do_restore_db.called)
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
|
|
||||||
mock_db_exists.return_value = True
|
mock_db_exists.return_value = True
|
||||||
launcher.heat_db_sync(restore_db=True)
|
launcher.heat_db_sync(restore_db=True)
|
||||||
self.assertFalse(self.check_calls('create database', self.check_call))
|
self.check_call.assert_called_once_with([
|
||||||
self.assertFalse(self.check_calls('create user', self.check_call))
|
'sudo', 'podman', 'run', '--rm', '--user', 'heat', '--volume',
|
||||||
self.assertFalse(self.check_calls('grant all', self.check_call))
|
mock.ANY, '--volume', mock.ANY,
|
||||||
self.assertFalse(self.check_calls('flush priv', self.check_call))
|
'quay.io/tripleomaster/openstack-heat-api:current-tripleo',
|
||||||
self.assertTrue(self.check_calls('heat-manage', self.check_call))
|
'heat-manage', 'db_sync'])
|
||||||
self.assertTrue(mock_do_restore_db.called)
|
self.assertTrue(mock_do_restore_db.called)
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
mock_db_exists.return_value = False
|
mock_db_exists.return_value = False
|
||||||
launcher.heat_db_sync(restore_db=True)
|
launcher.heat_db_sync(restore_db=True)
|
||||||
self.assertTrue(self.check_calls('create database', self.check_call))
|
calls = [
|
||||||
self.assertTrue(self.check_calls('create user', self.check_call))
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
self.assertTrue(self.check_calls('grant all', self.check_call))
|
'mysql', '-e', 'create database heat']),
|
||||||
self.assertTrue(self.check_calls('flush priv', self.check_call))
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
self.assertTrue(self.check_calls('heat-manage', self.check_call))
|
'mysql', '-e', "create user if not exists 'heat'@'%' "
|
||||||
|
"identified by 'heat'"]),
|
||||||
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
|
'mysql', 'heat', '-e', "grant all privileges on heat.* "
|
||||||
|
"to 'heat'@'%'"]),
|
||||||
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
|
'mysql', '-e', 'flush privileges;']),
|
||||||
|
mock.call(['sudo', 'podman', 'run', '--rm', '--user', 'heat',
|
||||||
|
'--volume', mock.ANY, '--volume', mock.ANY,
|
||||||
|
'quay.io/tripleomaster/openstack-heat-api:current-'
|
||||||
|
'tripleo', 'heat-manage', 'db_sync'])
|
||||||
|
]
|
||||||
|
self.assertEqual(self.check_call.mock_calls, calls)
|
||||||
self.assertTrue(mock_do_restore_db.called)
|
self.assertTrue(mock_do_restore_db.called)
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
mock_do_restore_db.reset_mock()
|
mock_do_restore_db.reset_mock()
|
||||||
mock_db_exists.return_value = False
|
mock_db_exists.return_value = False
|
||||||
launcher.heat_db_sync(restore_db=False)
|
launcher.heat_db_sync(restore_db=False)
|
||||||
self.assertTrue(self.check_calls('create database', self.check_call))
|
calls = [
|
||||||
self.assertTrue(self.check_calls('create user', self.check_call))
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
self.assertTrue(self.check_calls('grant all', self.check_call))
|
'mysql', '-e', 'create database heat']),
|
||||||
self.assertTrue(self.check_calls('flush priv', self.check_call))
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
self.assertTrue(self.check_calls('heat-manage', self.check_call))
|
'mysql', '-e', "create user if not exists 'heat'@'%' "
|
||||||
|
"identified by 'heat'"]),
|
||||||
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
|
'mysql', 'heat', '-e', "grant all privileges on heat.* "
|
||||||
|
"to 'heat'@'%'"]),
|
||||||
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
|
'mysql', '-e', 'flush privileges;']),
|
||||||
|
mock.call(['sudo', 'podman', 'run', '--rm', '--user', 'heat',
|
||||||
|
'--volume', mock.ANY, '--volume', mock.ANY,
|
||||||
|
'quay.io/tripleomaster/openstack-heat-api:current-'
|
||||||
|
'tripleo', 'heat-manage', 'db_sync'])
|
||||||
|
]
|
||||||
|
self.assertEqual(self.check_call.mock_calls, calls)
|
||||||
self.assertFalse(mock_do_restore_db.called)
|
self.assertFalse(mock_do_restore_db.called)
|
||||||
|
|
||||||
@mock.patch('os.unlink')
|
@mock.patch('os.unlink')
|
||||||
@ -217,17 +248,27 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
p.unlink()
|
p.unlink()
|
||||||
launcher.do_backup_db()
|
launcher.do_backup_db()
|
||||||
mock_tar.assert_called_with(str(p))
|
mock_tar.assert_called_with(str(p))
|
||||||
self.assertTrue(self.check_calls('mysqldump heat', self.run))
|
self.run.assert_called_once_with(['sudo', 'podman', 'exec', '-u',
|
||||||
|
'root', 'mysql', 'mysqldump',
|
||||||
|
'heat'],
|
||||||
|
check=True, stdout=mock.ANY)
|
||||||
|
|
||||||
def test_pod_exists(self):
|
def test_pod_exists(self):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_call.reset_mock()
|
||||||
self.assertTrue(launcher.pod_exists())
|
self.assertTrue(launcher.pod_exists())
|
||||||
self.check_calls('pod inspect', self.check_call)
|
self.check_call.assert_called_once_with(['sudo', 'podman', 'pod',
|
||||||
|
'inspect', 'ephemeral-heat'],
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
self.check_call.side_effect = subprocess.CalledProcessError(1, 'test')
|
self.check_call.side_effect = subprocess.CalledProcessError(1, 'test')
|
||||||
self.assertFalse(launcher.pod_exists())
|
self.assertFalse(launcher.pod_exists())
|
||||||
self.check_calls('pod inspect', self.check_call)
|
self.check_call.assert_called_once_with(['sudo', 'podman', 'pod',
|
||||||
|
'inspect', 'ephemeral-heat'],
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
@mock.patch('os.path.exists')
|
@mock.patch('os.path.exists')
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.tar_file')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.tar_file')
|
||||||
@ -241,6 +282,7 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
|
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
launcher.log_dir = '/log'
|
launcher.log_dir = '/log'
|
||||||
|
self.check_call.reset_mock()
|
||||||
|
|
||||||
mock_db_exists.return_value = True
|
mock_db_exists.return_value = True
|
||||||
mock_pod_exists.return_value = True
|
mock_pod_exists.return_value = True
|
||||||
@ -250,10 +292,16 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
'log_file': 'heat-log'}}
|
'log_file': 'heat-log'}}
|
||||||
launcher.rm_heat()
|
launcher.rm_heat()
|
||||||
mock_backup_db.assert_called()
|
mock_backup_db.assert_called()
|
||||||
self.check_calls('drop database heat', self.check_call)
|
calls = [
|
||||||
self.check_calls('drop user', self.check_call)
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
|
'mysql', 'heat', '-e', 'drop database heat']),
|
||||||
|
mock.call(['sudo', 'podman', 'exec', '-u', 'root', 'mysql',
|
||||||
|
'mysql', '-e', "drop user 'heat'@'%'"])
|
||||||
|
]
|
||||||
|
self.assertEqual(self.check_call.mock_calls, calls)
|
||||||
mock_pod_exists.assert_called()
|
mock_pod_exists.assert_called()
|
||||||
self.check_calls('podman pod rm -f', self.call)
|
self.call.assert_called_once_with(['sudo', 'podman', 'pod', 'rm', '-f',
|
||||||
|
'ephemeral-heat'])
|
||||||
mock_read_heat_config.assert_called()
|
mock_read_heat_config.assert_called()
|
||||||
mock_tar.assert_called_with('/log/heat-log')
|
mock_tar.assert_called_with('/log/heat-log')
|
||||||
|
|
||||||
@ -277,18 +325,21 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
mock_exists.return_value = True
|
mock_exists.return_value = True
|
||||||
launcher.rm_heat(backup_db=False)
|
launcher.rm_heat(backup_db=False)
|
||||||
mock_backup_db.assert_not_called()
|
mock_backup_db.assert_not_called()
|
||||||
self.check_calls('podman pod rm -f', self.call)
|
self.call.assert_called_once_with(['sudo', 'podman', 'pod', 'rm', '-f',
|
||||||
|
'ephemeral-heat'])
|
||||||
|
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.get_pod_state')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.get_pod_state')
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.pod_exists')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.pod_exists')
|
||||||
def test_stop_heat(self, mock_pod_exists, mock_pod_state):
|
def test_stop_heat(self, mock_pod_exists, mock_pod_state):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_call.reset_mock()
|
||||||
mock_pod_exists.return_value = True
|
mock_pod_exists.return_value = True
|
||||||
mock_pod_state.return_value = 'Running'
|
mock_pod_state.return_value = 'Running'
|
||||||
launcher.stop_heat()
|
launcher.stop_heat()
|
||||||
mock_pod_exists.assert_called()
|
mock_pod_exists.assert_called()
|
||||||
mock_pod_state.assert_called()
|
mock_pod_state.assert_called()
|
||||||
self.check_calls('podman pod stop', self.check_call)
|
self.check_call.asert_called_once_with(['sudo', 'podman', 'pod',
|
||||||
|
'stop', 'ephemeral-heat'])
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
mock_pod_exists.reset_mock()
|
mock_pod_exists.reset_mock()
|
||||||
@ -312,8 +363,13 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
|
|
||||||
def test_check_message_bus(self):
|
def test_check_message_bus(self):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_call.reset_mock()
|
||||||
launcher.check_message_bus()
|
launcher.check_message_bus()
|
||||||
self.check_calls('rabbitmqctl list_queues', self.check_call)
|
self.check_call.assert_called_once_with(['sudo', 'podman', 'exec',
|
||||||
|
'-u', 'root', 'rabbitmq',
|
||||||
|
'rabbitmqctl', 'list_queues'],
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
self.check_call.side_effect = subprocess.CalledProcessError(1, 'test')
|
self.check_call.side_effect = subprocess.CalledProcessError(1, 'test')
|
||||||
@ -324,11 +380,17 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
'tripleoclient.heat_launcher.HeatPodLauncher._get_ctlplane_ip')
|
'tripleoclient.heat_launcher.HeatPodLauncher._get_ctlplane_ip')
|
||||||
def test_check_database(self, mock_ctlplane_ip):
|
def test_check_database(self, mock_ctlplane_ip):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_call.reset_mock()
|
||||||
|
|
||||||
mock_ctlplane_ip.return_value = '1.1.1.1'
|
mock_ctlplane_ip.return_value = '1.1.1.1'
|
||||||
self.assertTrue(launcher.check_database())
|
self.assertTrue(launcher.check_database())
|
||||||
mock_ctlplane_ip.assert_called()
|
mock_ctlplane_ip.assert_called()
|
||||||
self.check_calls('show databases', self.check_call)
|
self.check_call.assert_called_once_with(['sudo', 'podman', 'exec',
|
||||||
|
'-u', 'root', 'mysql',
|
||||||
|
'mysql', '-h', '1.1.1.1',
|
||||||
|
'-e', 'show databases;'],
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
self.check_call.reset_mock()
|
self.check_call.reset_mock()
|
||||||
mock_ctlplane_ip.reset_mock()
|
mock_ctlplane_ip.reset_mock()
|
||||||
@ -338,21 +400,28 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
|
|
||||||
def test_database_exists(self):
|
def test_database_exists(self):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_output.reset_mock()
|
||||||
self.check_output.return_value = 'heat'
|
self.check_output.return_value = 'heat'
|
||||||
self.assertTrue(launcher.database_exists())
|
self.assertTrue(launcher.database_exists())
|
||||||
self.check_calls('show databases like "heat"', self.check_output)
|
self.check_output.assert_called_once_with([
|
||||||
|
'sudo', 'podman', 'exec', '-u', 'root', 'mysql', 'mysql', '-e',
|
||||||
|
'show databases like "heat"'])
|
||||||
|
|
||||||
self.check_output.reset_mock()
|
self.check_output.reset_mock()
|
||||||
self.check_output.return_value = 'nova'
|
self.check_output.return_value = 'nova'
|
||||||
self.assertFalse(launcher.database_exists())
|
self.assertFalse(launcher.database_exists())
|
||||||
self.check_calls('show databases like "heat"', self.check_output)
|
self.check_output.assert_called_once_with([
|
||||||
|
'sudo', 'podman', 'exec', '-u', 'root', 'mysql', 'mysql', '-e',
|
||||||
|
'show databases like "heat"'])
|
||||||
|
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.pod_exists')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher.pod_exists')
|
||||||
def test_kill_heat(self, mock_pod_exists):
|
def test_kill_heat(self, mock_pod_exists):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_output.reset_mock()
|
||||||
mock_pod_exists.return_value = True
|
mock_pod_exists.return_value = True
|
||||||
launcher.kill_heat(0)
|
launcher.kill_heat(0)
|
||||||
self.check_calls('podman pod kill', self.call)
|
self.call.assert_called_once_with(['sudo', 'podman', 'pod', 'kill',
|
||||||
|
'ephemeral-heat'])
|
||||||
mock_pod_exists.assert_called()
|
mock_pod_exists.assert_called()
|
||||||
|
|
||||||
mock_pod_exists.reset_mock()
|
mock_pod_exists.reset_mock()
|
||||||
@ -394,17 +463,21 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
||||||
def test_get_ctlplane_vip(self, mock_decode):
|
def test_get_ctlplane_vip(self, mock_decode):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_output.reset_mock()
|
||||||
self.check_output.return_value = '1.1.1.1'
|
self.check_output.return_value = '1.1.1.1'
|
||||||
launcher._get_ctlplane_vip()
|
launcher._get_ctlplane_vip()
|
||||||
self.check_calls('sudo hiera controller_virtual_ip', self.check_output)
|
self.check_output.assert_called_once_with(['sudo', 'hiera',
|
||||||
|
'controller_virtual_ip'])
|
||||||
mock_decode.assert_called_with('1.1.1.1')
|
mock_decode.assert_called_with('1.1.1.1')
|
||||||
|
|
||||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
||||||
def test_get_ctlplane_ip(self, mock_decode):
|
def test_get_ctlplane_ip(self, mock_decode):
|
||||||
launcher = self.get_launcher()
|
launcher = self.get_launcher()
|
||||||
|
self.check_output.reset_mock()
|
||||||
self.check_output.return_value = '1.1.1.1'
|
self.check_output.return_value = '1.1.1.1'
|
||||||
launcher._get_ctlplane_ip()
|
launcher._get_ctlplane_ip()
|
||||||
self.check_calls('sudo hiera ctlplane', self.check_output)
|
self.check_output.assert_called_once_with(['sudo', 'hiera',
|
||||||
|
'ctlplane'])
|
||||||
mock_decode.assert_called_with('1.1.1.1')
|
mock_decode.assert_called_with('1.1.1.1')
|
||||||
|
|
||||||
@mock.patch('multiprocessing.cpu_count')
|
@mock.patch('multiprocessing.cpu_count')
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import mock
|
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests.v1 import test_plugin
|
from tripleoclient.tests.v1 import test_plugin
|
||||||
from tripleoclient.v1 import overcloud_credentials
|
from tripleoclient.v1 import overcloud_credentials
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient import plugin
|
from tripleoclient import plugin
|
||||||
from tripleoclient.tests import base
|
from tripleoclient.tests import base
|
||||||
|
@ -19,7 +19,6 @@ import argparse
|
|||||||
import datetime
|
import datetime
|
||||||
import fixtures
|
import fixtures
|
||||||
import logging
|
import logging
|
||||||
import mock
|
|
||||||
import openstack
|
import openstack
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@ -27,6 +26,7 @@ import shutil
|
|||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
import ironic_inspector_client
|
import ironic_inspector_client
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import yaml
|
import yaml
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
@ -306,6 +306,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
mock_rc_params, mock_default_image_params,
|
mock_rc_params, mock_default_image_params,
|
||||||
mock_stack_data, mock_provision_networks,
|
mock_stack_data, mock_provision_networks,
|
||||||
mock_provision_virtual_ips):
|
mock_provision_virtual_ips):
|
||||||
|
mock_tmpdir.return_value = self.tmp_dir.path
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
utils_fixture = deployment.UtilsFixture()
|
utils_fixture = deployment.UtilsFixture()
|
||||||
@ -415,6 +416,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
mock_image_prepare, mock_generate_password,
|
mock_image_prepare, mock_generate_password,
|
||||||
mock_rc_params, mock_stack_data,
|
mock_rc_params, mock_stack_data,
|
||||||
mock_provision_networks, mock_provision_virtual_ips):
|
mock_provision_networks, mock_provision_virtual_ips):
|
||||||
|
mock_tmpdir.return_value = self.tmp_dir.path
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
utils_fixture = deployment.UtilsFixture()
|
utils_fixture = deployment.UtilsFixture()
|
||||||
@ -833,6 +835,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
mock_generate_password, mock_rc_params,
|
mock_generate_password, mock_rc_params,
|
||||||
mock_check_service_vip_migr,
|
mock_check_service_vip_migr,
|
||||||
mock_provision_networks, mock_provision_virtual_ips):
|
mock_provision_networks, mock_provision_virtual_ips):
|
||||||
|
mock_tmpdir.return_value = self.tmp_dir.path
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
clients = self.app.client_manager
|
clients = self.app.client_manager
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests import fakes as ooofakes
|
from tripleoclient.tests import fakes as ooofakes
|
||||||
from tripleoclient.tests.v1.overcloud_external_update import fakes
|
from tripleoclient.tests.v1.overcloud_external_update import fakes
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests import fakes as ooofakes
|
from tripleoclient.tests import fakes as ooofakes
|
||||||
from tripleoclient.tests.v1.overcloud_external_upgrade import fakes
|
from tripleoclient.tests.v1.overcloud_external_upgrade import fakes
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
import tripleo_common.arch
|
import tripleo_common.arch
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ import collections
|
|||||||
import copy
|
import copy
|
||||||
import fixtures
|
import fixtures
|
||||||
import json
|
import json
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.tests import utils as test_utils
|
from osc_lib.tests import utils as test_utils
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleo_common.exception import NotFound
|
from tripleo_common.exception import NotFound
|
||||||
from tripleoclient.tests.v1.overcloud_deploy import fakes
|
from tripleoclient.tests.v1.overcloud_deploy import fakes
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests.utils import ParserException
|
from osc_lib.tests.utils import ParserException
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.tests.utils import ParserException
|
from osc_lib.tests.utils import ParserException
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
@ -24,6 +23,7 @@ import tempfile
|
|||||||
from urllib import parse
|
from urllib import parse
|
||||||
import uuid
|
import uuid
|
||||||
import yaml
|
import yaml
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from tripleo_common.image import kolla_builder
|
from tripleo_common.image import kolla_builder
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests.v1 import test_plugin
|
from tripleoclient.tests.v1 import test_plugin
|
||||||
from tripleoclient import utils
|
from tripleoclient import utils
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import mock
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils as test_utils
|
from osc_lib.tests import utils as test_utils
|
||||||
|
|
||||||
@ -51,7 +51,6 @@ class TestConfigureBIOS(Base):
|
|||||||
autospec=True
|
autospec=True
|
||||||
)
|
)
|
||||||
playbook_runner.start()
|
playbook_runner.start()
|
||||||
self.addCleanup(playbook_runner.stop)
|
|
||||||
|
|
||||||
def test_configure_specified_nodes_ok(self):
|
def test_configure_specified_nodes_ok(self):
|
||||||
conf = json.dumps(self.conf)
|
conf = json.dumps(self.conf)
|
||||||
@ -150,7 +149,6 @@ class TestResetBIOS(Base):
|
|||||||
autospec=True
|
autospec=True
|
||||||
)
|
)
|
||||||
playbook_runner.start()
|
playbook_runner.start()
|
||||||
self.addCleanup(playbook_runner.stop)
|
|
||||||
|
|
||||||
def test_reset_specified_nodes_ok(self):
|
def test_reset_specified_nodes_ok(self):
|
||||||
arglist = ['node_uuid1', 'node_uuid2']
|
arglist = ['node_uuid1', 'node_uuid2']
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient import exceptions
|
from tripleoclient import exceptions
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import mock
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils as test_utils
|
from osc_lib.tests import utils as test_utils
|
||||||
|
|
||||||
@ -49,7 +49,6 @@ class TestCreateRAID(fakes.TestBaremetal):
|
|||||||
autospec=True
|
autospec=True
|
||||||
)
|
)
|
||||||
playbook_runner.start()
|
playbook_runner.start()
|
||||||
self.addCleanup(playbook_runner.stop)
|
|
||||||
|
|
||||||
def test_ok(self):
|
def test_ok(self):
|
||||||
conf = json.dumps(self.conf)
|
conf = json.dumps(self.conf)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests import base
|
from tripleoclient.tests import base
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
|
@ -18,10 +18,7 @@ Tests basic parser behavior, with both default and user supplied
|
|||||||
values of arguments.
|
values of arguments.
|
||||||
Further assertions are placed on results of the parser.
|
Further assertions are placed on results of the parser.
|
||||||
"""
|
"""
|
||||||
try:
|
from unittest import mock
|
||||||
from unittest import mock
|
|
||||||
except ImportError:
|
|
||||||
import mock
|
|
||||||
|
|
||||||
from tripleoclient.tests import base
|
from tripleoclient.tests import base
|
||||||
|
|
||||||
|
@ -13,10 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
from unittest import mock
|
||||||
from unittest import mock
|
|
||||||
except ImportError:
|
|
||||||
import mock
|
|
||||||
|
|
||||||
from tripleoclient.tests import base
|
from tripleoclient.tests import base
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import yaml
|
import yaml
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from heatclient import exc as hc_exc
|
from heatclient import exc as hc_exc
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
for call in mock_yaml_dump.call_args_list:
|
for call in mock_yaml_dump.call_args_list:
|
||||||
args, kwargs = call
|
args, kwargs = call
|
||||||
for a in args:
|
for a in args:
|
||||||
if isinstance(a, mock.mock.MagicMock):
|
if isinstance(a, mock.MagicMock):
|
||||||
continue
|
continue
|
||||||
if a.get('parameter_defaults', {}).get('StackAction', None):
|
if a.get('parameter_defaults', {}).get('StackAction', None):
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@ -1157,9 +1157,9 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
'--output-only'], [])
|
'--output-only'], [])
|
||||||
|
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
self.assertEqual(1, mock_ac.call_count)
|
call = mock.call('/foo', mock.ANY, ssh_private_key=None,
|
||||||
self.assertEqual(
|
transport='local')
|
||||||
"local", mock_ac.call_args_list[0].kwargs["transport"])
|
self.assertEqual(mock_ac.mock_calls, [call])
|
||||||
|
|
||||||
# Test transport "ssh"
|
# Test transport "ssh"
|
||||||
mock_ac.reset_mock()
|
mock_ac.reset_mock()
|
||||||
@ -1172,5 +1172,6 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
'--transport', 'ssh'], [])
|
'--transport', 'ssh'], [])
|
||||||
|
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
self.assertEqual(1, mock_ac.call_count)
|
call = mock.call('/foo', mock.ANY, ssh_private_key=None,
|
||||||
self.assertEqual("ssh", mock_ac.call_args_list[0].kwargs["transport"])
|
transport='ssh')
|
||||||
|
self.assertEqual(mock_ac.mock_calls, [call])
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ from cryptography import x509
|
|||||||
from cryptography.x509.oid import NameOID
|
from cryptography.x509.oid import NameOID
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from unittest import mock
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import yaml
|
import yaml
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import json
|
import json
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
from tripleoclient.tests.v1.overcloud_deploy import fakes as deploy_fakes
|
from tripleoclient.tests.v1.overcloud_deploy import fakes as deploy_fakes
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions as osc_lib_exc
|
from osc_lib import exceptions as osc_lib_exc
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#
|
#
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
|
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib import exceptions as osc_lib_exc
|
from osc_lib import exceptions as osc_lib_exc
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
import collections
|
import collections
|
||||||
import fixtures
|
import fixtures
|
||||||
import json
|
import json
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils as test_utils
|
from osc_lib.tests import utils as test_utils
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import ironic_inspector_client
|
import ironic_inspector_client
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
|
@ -12,10 +12,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user