def setUp(self): # enable vTPM and use our own fake key service self.flags(swtpm_enabled=True, group='libvirt') self.flags( backend='nova.tests.functional.libvirt.test_vtpm.FakeKeyManager', group='key_manager') super().setUp() # mock the '_check_vtpm_support' function which validates things like # the presence of users on the host, none of which makes sense here _p = mock.patch( 'nova.virt.libvirt.driver.LibvirtDriver._check_vtpm_support') self.mock_conn = _p.start() self.addCleanup(_p.stop) self.key_mgr = crypto._get_key_manager()
def setUp(self): # enable vTPM and use our own fake key service self.flags(swtpm_enabled=True, group='libvirt') self.flags( backend='nova.tests.functional.libvirt.test_vtpm.FakeKeyManager', group='key_manager') super().setUp() original_which = shutil.which def which(cmd, *args, **kwargs): if cmd == 'swtpm': return True return original_which(cmd, *args, **kwargs) self.useFixture(fixtures.MonkeyPatch('shutil.which', which)) self.key_mgr = crypto._get_key_manager()