Replace random uuid with fake uuid in unit tests
Replace the randomly generated ids with specified fake uuids in unit tests, and make it easier to search for patterns of failures in CI logs. Change-Id: Iea51fa0d2aa2eb56129261cae8bd896b46265edf
This commit is contained in:
@@ -18,7 +18,6 @@ import binascii
|
|||||||
import copy
|
import copy
|
||||||
import mock
|
import mock
|
||||||
import six
|
import six
|
||||||
import uuid
|
|
||||||
|
|
||||||
from castellan.common.objects import symmetric_key as key
|
from castellan.common.objects import symmetric_key as key
|
||||||
from castellan.tests.unit.key_manager import fake
|
from castellan.tests.unit.key_manager import fake
|
||||||
@@ -65,7 +64,7 @@ class CryptsetupEncryptorTestCase(test_base.VolumeEncryptorTestCase):
|
|||||||
|
|
||||||
@mock.patch('os_brick.executor.Executor._execute')
|
@mock.patch('os_brick.executor.Executor._execute')
|
||||||
def test_attach_volume(self, mock_execute):
|
def test_attach_volume(self, mock_execute):
|
||||||
fake_key = uuid.uuid4().hex
|
fake_key = 'e8b76872e3b04c18b3b6656bbf6f5089'
|
||||||
self.encryptor._get_key = mock.MagicMock()
|
self.encryptor._get_key = mock.MagicMock()
|
||||||
self.encryptor._get_key.return_value = fake__get_key(None, fake_key)
|
self.encryptor._get_key.return_value = fake__get_key(None, fake_key)
|
||||||
|
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
from castellan.common.objects import symmetric_key as key
|
from castellan.common.objects import symmetric_key as key
|
||||||
from os_brick.encryptors import luks
|
from os_brick.encryptors import luks
|
||||||
@@ -82,7 +80,7 @@ class LuksEncryptorTestCase(test_cryptsetup.CryptsetupEncryptorTestCase):
|
|||||||
|
|
||||||
@mock.patch('os_brick.executor.Executor._execute')
|
@mock.patch('os_brick.executor.Executor._execute')
|
||||||
def test_attach_volume(self, mock_execute):
|
def test_attach_volume(self, mock_execute):
|
||||||
fake_key = uuid.uuid4().hex
|
fake_key = '0c84146034e747639b698368807286df'
|
||||||
self.encryptor._get_key = mock.MagicMock()
|
self.encryptor._get_key = mock.MagicMock()
|
||||||
self.encryptor._get_key.return_value = (
|
self.encryptor._get_key.return_value = (
|
||||||
test_cryptsetup.fake__get_key(None, fake_key))
|
test_cryptsetup.fake__get_key(None, fake_key))
|
||||||
@@ -102,7 +100,7 @@ class LuksEncryptorTestCase(test_cryptsetup.CryptsetupEncryptorTestCase):
|
|||||||
|
|
||||||
@mock.patch('os_brick.executor.Executor._execute')
|
@mock.patch('os_brick.executor.Executor._execute')
|
||||||
def test_attach_volume_not_formatted(self, mock_execute):
|
def test_attach_volume_not_formatted(self, mock_execute):
|
||||||
fake_key = uuid.uuid4().hex
|
fake_key = 'bc37c5eccebe403f9cc2d0dd20dac2bc'
|
||||||
self.encryptor._get_key = mock.MagicMock()
|
self.encryptor._get_key = mock.MagicMock()
|
||||||
self.encryptor._get_key.return_value = (
|
self.encryptor._get_key.return_value = (
|
||||||
test_cryptsetup.fake__get_key(None, fake_key))
|
test_cryptsetup.fake__get_key(None, fake_key))
|
||||||
@@ -141,7 +139,7 @@ class LuksEncryptorTestCase(test_cryptsetup.CryptsetupEncryptorTestCase):
|
|||||||
|
|
||||||
@mock.patch('os_brick.executor.Executor._execute')
|
@mock.patch('os_brick.executor.Executor._execute')
|
||||||
def test_attach_volume_fail(self, mock_execute):
|
def test_attach_volume_fail(self, mock_execute):
|
||||||
fake_key = uuid.uuid4().hex
|
fake_key = 'ea6c2e1b8f7f4f84ae3560116d659ba2'
|
||||||
self.encryptor._get_key = mock.MagicMock()
|
self.encryptor._get_key = mock.MagicMock()
|
||||||
self.encryptor._get_key.return_value = (
|
self.encryptor._get_key.return_value = (
|
||||||
test_cryptsetup.fake__get_key(None, fake_key))
|
test_cryptsetup.fake__get_key(None, fake_key))
|
||||||
|
Reference in New Issue
Block a user