def test_verify_extensions_neutron(self):
        def fake_list_extensions():
            return {
                'extensions': [{
                    'alias': 'fake1'
                }, {
                    'alias': 'fake2'
                }, {
                    'alias': 'not_fake'
                }]
            }

        fake_os = mock.MagicMock()
        fake_os.network_client.list_extensions = fake_list_extensions
        self.useFixture(
            mockpatch.PatchObject(verify_tempest_config,
                                  'get_enabled_extensions',
                                  return_value=(['fake1', 'fake2', 'fake3'])))
        results = verify_tempest_config.verify_extensions(
            fake_os, 'neutron', {})
        self.assertIn('neutron', results)
        self.assertIn('fake1', results['neutron'])
        self.assertTrue(results['neutron']['fake1'])
        self.assertIn('fake2', results['neutron'])
        self.assertTrue(results['neutron']['fake2'])
        self.assertIn('fake3', results['neutron'])
        self.assertFalse(results['neutron']['fake3'])
        self.assertIn('not_fake', results['neutron'])
        self.assertFalse(results['neutron']['not_fake'])
Example #2
0
    def test_verify_extensions_swift_all(self):
        def fake_list_extensions():
            return {
                'fake1': 'metadata',
                'fake2': 'metadata',
                'not_fake': 'metadata',
                'swift': 'metadata'
            }

        fake_os = mock.MagicMock()
        fake_client = mock.MagicMock()
        fake_client.list_capabilities = fake_list_extensions
        self.useFixture(
            fixtures.MockPatchObject(verify_tempest_config,
                                     'get_extension_client',
                                     return_value=fake_client))
        self.useFixture(
            fixtures.MockPatchObject(verify_tempest_config,
                                     'get_enabled_extensions',
                                     return_value=(['all'])))
        results = verify_tempest_config.verify_extensions(fake_os, 'swift', {})
        self.assertIn('swift', results)
        self.assertIn('extensions', results['swift'])
        self.assertEqual(sorted(['not_fake', 'fake1', 'fake2']),
                         sorted(results['swift']['extensions']))
Example #3
0
    def test_verify_extensions_nova(self):
        def fake_list_extensions():
            return ([{
                'alias': 'fake1'
            }, {
                'alias': 'fake2'
            }, {
                'alias': 'not_fake'
            }])

        fake_os = mock.MagicMock()
        fake_client = mock.MagicMock()
        fake_client.list_extensions = fake_list_extensions
        self.useFixture(
            fixtures.MockPatchObject(verify_tempest_config,
                                     'get_extension_client',
                                     return_value=fake_client))
        self.useFixture(
            fixtures.MockPatchObject(verify_tempest_config,
                                     'get_enabled_extensions',
                                     return_value=(['fake1', 'fake2',
                                                    'fake3'])))
        results = verify_tempest_config.verify_extensions(fake_os, 'nova', {})
        self.assertIn('nova', results)
        self.assertIn('fake1', results['nova'])
        self.assertTrue(results['nova']['fake1'])
        self.assertIn('fake2', results['nova'])
        self.assertTrue(results['nova']['fake2'])
        self.assertIn('fake3', results['nova'])
        self.assertFalse(results['nova']['fake3'])
        self.assertIn('not_fake', results['nova'])
        self.assertFalse(results['nova']['not_fake'])
Example #4
0
    def test_verify_extensions_swift(self):
        def fake_list_extensions():
            return (None, {
                'fake1': 'metadata',
                'fake2': 'metadata',
                'not_fake': 'metadata',
                'swift': 'metadata'
            })

        fake_os = mock.MagicMock()
        fake_os.account_client.list_extensions = fake_list_extensions
        self.useFixture(
            mockpatch.PatchObject(verify_tempest_config,
                                  'get_enabled_extensions',
                                  return_value=(['fake1', 'fake2', 'fake3'])))
        results = verify_tempest_config.verify_extensions(fake_os, 'swift', {})
        self.assertIn('swift', results)
        self.assertIn('fake1', results['swift'])
        self.assertTrue(results['swift']['fake1'])
        self.assertIn('fake2', results['swift'])
        self.assertTrue(results['swift']['fake2'])
        self.assertIn('fake3', results['swift'])
        self.assertFalse(results['swift']['fake3'])
        self.assertIn('not_fake', results['swift'])
        self.assertFalse(results['swift']['not_fake'])
    def test_verify_extensions_cinder(self):
        def fake_list_extensions():
            return {'extensions': [{'alias': 'fake1'},
                                   {'alias': 'fake2'},
                                   {'alias': 'not_fake'}]}
        fake_os = mock.MagicMock()
        fake_client = mock.MagicMock()
        fake_client.list_extensions = fake_list_extensions
        self.useFixture(fixtures.MockPatchObject(
            verify_tempest_config, 'get_extension_client',
            return_value=fake_client))
        self.useFixture(fixtures.MockPatchObject(
            verify_tempest_config, 'get_enabled_extensions',
            return_value=(['fake1', 'fake2', 'fake3'])))
        results = verify_tempest_config.verify_extensions(fake_os,
                                                          'cinder', {})

        self.assertIn('cinder', results)
        self.assertIn('fake1', results['cinder'])
        self.assertTrue(results['cinder']['fake1'])
        self.assertIn('fake2', results['cinder'])
        self.assertTrue(results['cinder']['fake2'])
        self.assertIn('fake3', results['cinder'])
        self.assertFalse(results['cinder']['fake3'])
        self.assertIn('not_fake', results['cinder'])
        self.assertFalse(results['cinder']['not_fake'])
 def test_verify_extensions_swift(self):
     def fake_list_extensions():
         return {'fake1': 'metadata',
                 'fake2': 'metadata',
                 'not_fake': 'metadata',
                 'swift': 'metadata'}
     fake_os = mock.MagicMock()
     fake_client = mock.MagicMock()
     fake_client.list_capabilities = fake_list_extensions
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_extension_client',
         return_value=fake_client))
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['fake1', 'fake2', 'fake3'])))
     results = verify_tempest_config.verify_extensions(fake_os, 'swift', {})
     self.assertIn('swift', results)
     self.assertIn('fake1', results['swift'])
     self.assertTrue(results['swift']['fake1'])
     self.assertIn('fake2', results['swift'])
     self.assertTrue(results['swift']['fake2'])
     self.assertIn('fake3', results['swift'])
     self.assertFalse(results['swift']['fake3'])
     self.assertIn('not_fake', results['swift'])
     self.assertFalse(results['swift']['not_fake'])
Example #7
0
    def test_verify_extensions_cinder(self):
        def fake_list_extensions():
            return (None, {
                'extensions': [{
                    'name': 'fake1'
                }, {
                    'name': 'fake2'
                }, {
                    'name': 'not_fake'
                }]
            })

        fake_os = mock.MagicMock()
        fake_os.volumes_extension_client.list_extensions = fake_list_extensions
        self.useFixture(
            mockpatch.PatchObject(verify_tempest_config,
                                  'get_enabled_extensions',
                                  return_value=(['fake1', 'fake2', 'fake3'])))
        results = verify_tempest_config.verify_extensions(
            fake_os, 'cinder', {})
        self.assertIn('cinder', results)
        self.assertIn('fake1', results['cinder'])
        self.assertTrue(results['cinder']['fake1'])
        self.assertIn('fake2', results['cinder'])
        self.assertTrue(results['cinder']['fake2'])
        self.assertIn('fake3', results['cinder'])
        self.assertFalse(results['cinder']['fake3'])
        self.assertIn('not_fake', results['cinder'])
        self.assertFalse(results['cinder']['not_fake'])
Example #8
0
    def test_verify_extensions_nova_all(self):
        def fake_list_extensions():
            return ({
                'extensions': [{
                    'alias': 'fake1'
                }, {
                    'alias': 'fake2'
                }, {
                    'alias': 'not_fake'
                }]
            })

        fake_os = mock.MagicMock()
        fake_client = mock.MagicMock()
        fake_client.list_extensions = fake_list_extensions
        self.useFixture(
            fixtures.MockPatchObject(verify_tempest_config,
                                     'get_extension_client',
                                     return_value=fake_client))
        self.useFixture(
            fixtures.MockPatchObject(verify_tempest_config,
                                     'get_enabled_extensions',
                                     return_value=(['all'])))
        results = verify_tempest_config.verify_extensions(fake_os, 'nova', {})
        self.assertIn('nova', results)
        self.assertIn('extensions', results['nova'])
        self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
                         sorted(results['nova']['extensions']))
    def test_verify_extensions_cinder_all(self):
        def fake_list_extensions():
            return {
                'extensions': [{
                    'alias': 'fake1'
                }, {
                    'alias': 'fake2'
                }, {
                    'alias': 'not_fake'
                }]
            }

        fake_os = mock.MagicMock()
        # NOTE (e0ne): mock both v1 and v2 APIs
        fake_os.volumes_extension_client.list_extensions = fake_list_extensions
        fake_os.volumes_v2_extension_client.list_extensions = (
            fake_list_extensions)
        self.useFixture(
            mockpatch.PatchObject(verify_tempest_config,
                                  'get_enabled_extensions',
                                  return_value=(['all'])))
        results = verify_tempest_config.verify_extensions(
            fake_os, 'cinder', {})
        self.assertIn('cinder', results)
        self.assertIn('extensions', results['cinder'])
        self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
                         sorted(results['cinder']['extensions']))
    def test_verify_extensions_swift_all(self):
        def fake_list_extensions():
            return (None, {"fake1": "metadata", "fake2": "metadata", "not_fake": "metadata", "swift": "metadata"})

        fake_os = mock.MagicMock()
        fake_os.account_client.list_extensions = fake_list_extensions
        self.useFixture(mockpatch.PatchObject(verify_tempest_config, "get_enabled_extensions", return_value=(["all"])))
        results = verify_tempest_config.verify_extensions(fake_os, "swift", {})
        self.assertIn("swift", results)
        self.assertIn("extensions", results["swift"])
        self.assertEqual(sorted(["not_fake", "fake1", "fake2"]), sorted(results["swift"]["extensions"]))
    def test_verify_extensions_nova_all(self):
        def fake_list_extensions():
            return {"extensions": [{"alias": "fake1"}, {"alias": "fake2"}, {"alias": "not_fake"}]}

        fake_os = mock.MagicMock()
        fake_os.extensions_client.list_extensions = fake_list_extensions
        self.useFixture(mockpatch.PatchObject(verify_tempest_config, "get_enabled_extensions", return_value=(["all"])))
        results = verify_tempest_config.verify_extensions(fake_os, "nova", {})
        self.assertIn("nova", results)
        self.assertIn("extensions", results["nova"])
        self.assertEqual(sorted(["fake1", "fake2", "not_fake"]), sorted(results["nova"]["extensions"]))
    def test_verify_extensions_cinder_all(self):
        def fake_list_extensions():
            return {"extensions": [{"alias": "fake1"}, {"alias": "fake2"}, {"alias": "not_fake"}]}

        fake_os = mock.MagicMock()
        # NOTE (e0ne): mock both v1 and v2 APIs
        fake_os.volumes_extension_client.list_extensions = fake_list_extensions
        fake_os.volumes_v2_extension_client.list_extensions = fake_list_extensions
        self.useFixture(mockpatch.PatchObject(verify_tempest_config, "get_enabled_extensions", return_value=(["all"])))
        results = verify_tempest_config.verify_extensions(fake_os, "cinder", {})
        self.assertIn("cinder", results)
        self.assertIn("extensions", results["cinder"])
        self.assertEqual(sorted(["fake1", "fake2", "not_fake"]), sorted(results["cinder"]["extensions"]))
 def test_verify_extensions_nova_all(self):
     def fake_list_extensions():
         return ({'extensions': [{'alias': 'fake1'},
                                 {'alias': 'fake2'},
                                 {'alias': 'not_fake'}]})
     fake_os = mock.MagicMock()
     fake_os.extensions_client.list_extensions = fake_list_extensions
     self.useFixture(mockpatch.PatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'nova', {})
     self.assertIn('nova', results)
     self.assertIn('extensions', results['nova'])
     self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
                      sorted(results['nova']['extensions']))
 def test_verify_extensions_nova_v3_all(self):
     def fake_list_extensions():
         return (None, {'extensions': [{'name': 'fake1'},
                                       {'name': 'fake2'},
                                       {'name': 'not_fake'}]})
     fake_os = mock.MagicMock()
     fake_os.extensions_v3_client.list_extensions = fake_list_extensions
     self.useFixture(mockpatch.PatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'nova_v3', {})
     self.assertIn('nova_v3', results)
     self.assertIn('extensions', results['nova_v3'])
     self.assertEqual(['fake1', 'fake2', 'not_fake'],
                      results['nova_v3']['extensions'])
 def test_verify_extensions_cinder_all(self):
     def fake_list_extensions():
         return (None, {'extensions': [{'name': 'fake1'},
                                       {'name': 'fake2'},
                                       {'name': 'not_fake'}]})
     fake_os = mock.MagicMock()
     fake_os.volumes_extension_client.list_extensions = fake_list_extensions
     self.useFixture(mockpatch.PatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'cinder', {})
     self.assertIn('cinder', results)
     self.assertIn('extensions', results['cinder'])
     self.assertEqual(['fake1', 'fake2', 'not_fake'],
                      results['cinder']['extensions'])
 def test_verify_extensions_swift_all(self):
     def fake_list_extensions():
         return (None, {'fake1': 'metadata',
                        'fake2': 'metadata',
                        'not_fake': 'metadata',
                        'swift': 'metadata'})
     fake_os = mock.MagicMock()
     fake_os.account_client.list_extensions = fake_list_extensions
     self.useFixture(mockpatch.PatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'swift', {})
     self.assertIn('swift', results)
     self.assertIn('extensions', results['swift'])
     self.assertEqual(sorted(['not_fake', 'fake1', 'fake2']),
                      sorted(results['swift']['extensions']))
 def test_verify_extensions_swift_none(self):
     def fake_list_extensions():
         return {'swift': 'metadata'}
     fake_os = mock.MagicMock()
     fake_client = mock.MagicMock()
     fake_client.list_capabilities = fake_list_extensions
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_extension_client',
         return_value=fake_client))
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'swift', {})
     self.assertIn('swift', results)
     self.assertIn('extensions', results['swift'])
     self.assertEqual([], results['swift']['extensions'])
 def test_verify_extensions_nova_none(self):
     def fake_list_extensions():
         return ({'extensions': []})
     fake_os = mock.MagicMock()
     fake_client = mock.MagicMock()
     fake_client.list_extensions = fake_list_extensions
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_extension_client',
         return_value=fake_client))
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'nova', {})
     self.assertIn('nova', results)
     self.assertIn('extensions', results['nova'])
     self.assertEqual([], results['nova']['extensions'])
Example #19
0
 def test_verify_extensions_nova_none(self):
     def fake_list_extensions():
         return ({'extensions': []})
     fake_os = mock.MagicMock()
     fake_client = mock.MagicMock()
     fake_client.list_extensions = fake_list_extensions
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_extension_client',
         return_value=fake_client))
     self.useFixture(fixtures.MockPatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'nova', {})
     self.assertIn('nova', results)
     self.assertIn('extensions', results['nova'])
     self.assertEqual([], results['nova']['extensions'])
 def test_verify_extensions_cinder_all(self):
     def fake_list_extensions():
         return {'extensions': [{'alias': 'fake1'},
                                {'alias': 'fake2'},
                                {'alias': 'not_fake'}]}
     fake_os = mock.MagicMock()
     # NOTE (e0ne): mock both v1 and v2 APIs
     fake_os.volumes_extension_client.list_extensions = fake_list_extensions
     fake_os.volumes_v2_extension_client.list_extensions = (
         fake_list_extensions)
     self.useFixture(mockpatch.PatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['all'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'cinder', {})
     self.assertIn('cinder', results)
     self.assertIn('extensions', results['cinder'])
     self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
                      sorted(results['cinder']['extensions']))
 def test_verify_extensions_nova(self):
     def fake_list_extensions():
         return ([{'alias': 'fake1'}, {'alias': 'fake2'},
                  {'alias': 'not_fake'}])
     fake_os = mock.MagicMock()
     fake_os.extensions_client.list_extensions = fake_list_extensions
     self.useFixture(mockpatch.PatchObject(
         verify_tempest_config, 'get_enabled_extensions',
         return_value=(['fake1', 'fake2', 'fake3'])))
     results = verify_tempest_config.verify_extensions(fake_os,
                                                       'nova', {})
     self.assertIn('nova', results)
     self.assertIn('fake1', results['nova'])
     self.assertTrue(results['nova']['fake1'])
     self.assertIn('fake2', results['nova'])
     self.assertTrue(results['nova']['fake2'])
     self.assertIn('fake3', results['nova'])
     self.assertFalse(results['nova']['fake3'])
     self.assertIn('not_fake', results['nova'])
     self.assertFalse(results['nova']['not_fake'])
    def test_verify_extensions_cinder(self):
        def fake_list_extensions():
            return (None, {"extensions": [{"name": "fake1"}, {"name": "fake2"}, {"name": "not_fake"}]})

        fake_os = mock.MagicMock()
        fake_os.volumes_extension_client.list_extensions = fake_list_extensions
        self.useFixture(
            mockpatch.PatchObject(
                verify_tempest_config, "get_enabled_extensions", return_value=(["fake1", "fake2", "fake3"])
            )
        )
        results = verify_tempest_config.verify_extensions(fake_os, "cinder", {})
        self.assertIn("cinder", results)
        self.assertIn("fake1", results["cinder"])
        self.assertTrue(results["cinder"]["fake1"])
        self.assertIn("fake2", results["cinder"])
        self.assertTrue(results["cinder"]["fake2"])
        self.assertIn("fake3", results["cinder"])
        self.assertFalse(results["cinder"]["fake3"])
        self.assertIn("not_fake", results["cinder"])
        self.assertFalse(results["cinder"]["not_fake"])
    def test_verify_extensions_nova(self):
        def fake_list_extensions():
            return [{"alias": "fake1"}, {"alias": "fake2"}, {"alias": "not_fake"}]

        fake_os = mock.MagicMock()
        fake_os.extensions_client.list_extensions = fake_list_extensions
        self.useFixture(
            mockpatch.PatchObject(
                verify_tempest_config, "get_enabled_extensions", return_value=(["fake1", "fake2", "fake3"])
            )
        )
        results = verify_tempest_config.verify_extensions(fake_os, "nova", {})
        self.assertIn("nova", results)
        self.assertIn("fake1", results["nova"])
        self.assertTrue(results["nova"]["fake1"])
        self.assertIn("fake2", results["nova"])
        self.assertTrue(results["nova"]["fake2"])
        self.assertIn("fake3", results["nova"])
        self.assertFalse(results["nova"]["fake3"])
        self.assertIn("not_fake", results["nova"])
        self.assertFalse(results["nova"]["not_fake"])