Esempio n. 1
0
 def test_driver_warnings_on_files(self):
     with warnings.catch_warnings(record=True) as the_warnings:
         driver.build_tests(
             self.test_dir, self.loader, host='localhost', port=8001)
         self.assertEqual(1, len(the_warnings))
         the_warning = the_warnings[-1]
         self.assertEqual(
             the_warning.category, exception.GabbiSyntaxWarning)
         self.assertIn("'_' in test filename", str(the_warning.message))
Esempio n. 2
0
 def test_driver_warnings_on_files(self):
     with warnings.catch_warnings(record=True) as the_warnings:
         driver.build_tests(self.test_dir,
                            self.loader,
                            host='localhost',
                            port=8001)
         self.assertEqual(1, len(the_warnings))
         the_warning = the_warnings[-1]
         self.assertEqual(the_warning.category,
                          exception.GabbiSyntaxWarning)
         self.assertIn("'_' in test filename", str(the_warning.message))
Esempio n. 3
0
    def test_build_require_ssl(self):
        suite = driver.build_tests(self.test_dir, self.loader,
                                   host='localhost',
                                   require_ssl=True)
        first_test = suite._tests[0]._tests[0]
        full_url = first_test._parse_url(first_test.test_data['url'])
        self.assertEqual('https://localhost:8001/', full_url)

        suite = driver.build_tests(self.test_dir, self.loader,
                                   host='localhost',
                                   require_ssl=False)
        first_test = suite._tests[0]._tests[0]
        full_url = first_test._parse_url(first_test.test_data['url'])
        self.assertEqual('http://localhost:8001/', full_url)
Esempio n. 4
0
    def resource_setup(cls):
        super(GnocchiGabbiTest, cls).resource_setup()

        url = cls.os_admin.auth_provider.base_url({
            'service':
            CONF.metric.catalog_type,
            'endpoint_type':
            CONF.metric.endpoint_type
        })
        token = cls.os_admin.auth_provider.get_token()

        parsed_url = urlparse.urlsplit(url)
        prefix = parsed_url.path.rstrip('/')  # turn it into a prefix
        port = 443 if parsed_url.scheme == 'https' else 80
        host = parsed_url.hostname
        if parsed_url.port:
            port = parsed_url.port

        test_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'tests',
                                'gabbi', 'gabbits-live')
        cls.tests = driver.build_tests(
            test_dir,
            unittest.TestLoader(),
            host=host,
            port=port,
            prefix=prefix,
            test_loader_name='tempest.scenario.gnocchi.test')

        os.environ["GNOCCHI_SERVICE_TOKEN"] = token
Esempio n. 5
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              prefix='/telemetry',
                              intercept=app.VersionSelectorApplication,
                              fixture_module=fixture_module)
Esempio n. 6
0
    def resource_setup(cls):
        super(GnocchiGabbiTest, cls).resource_setup()

        url = cls.os_admin.auth_provider.base_url(
            {'service':  CONF.metric.catalog_type,
             'endpoint_type': CONF.metric.endpoint_type})
        token = cls.os_admin.auth_provider.get_token()

        parsed_url = urlparse.urlsplit(url)
        prefix = parsed_url.path.rstrip('/')  # turn it into a prefix
        if parsed_url.scheme == 'https':
            port = 443
            require_ssl = True
        else:
            port = 80
            require_ssl = False
        host = parsed_url.hostname
        if parsed_url.port:
            port = parsed_url.port

        test_dir = os.path.join(os.path.dirname(__file__), '..', '..',
                                'tests', 'gabbi', 'gabbits-live')
        cls.tests = driver.build_tests(
            test_dir, unittest.TestLoader(),
            host=host, port=port, prefix=prefix,
            test_loader_name='tempest.scenario.gnocchi.test',
            require_ssl=require_ssl)

        os.environ["GNOCCHI_SERVICE_TOKEN"] = token
Esempio n. 7
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              test_loader_name=__name__,
                              intercept=fixtures.setup_app,
                              fixture_module=fixtures)
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              test_loader_name=__name__,
                              intercept=app)
Esempio n. 9
0
    def resource_setup(cls):
        super(TestAutoscalingGabbi, cls).resource_setup()
        test_dir = os.path.join(os.path.dirname(__file__), '..', '..',
                                'integration', 'gabbi', 'gabbits-live')
        cls.tests = driver.build_tests(
            test_dir, unittest.TestLoader(),
            host='localhost', port='13245',
            test_loader_name='tempest.scenario.telemetry-autoscaling.test')

        auth = cls.os_admin.auth_provider.get_auth()
        os.environ["ADMIN_TOKEN"] = auth[0]
        os.environ["AODH_SERVICE_URL"] = cls._get_endpoint_for(
            auth, "alarming_plugin")
        os.environ["GNOCCHI_SERVICE_URL"] = cls._get_endpoint_for(
            auth, "metric")
        os.environ["HEAT_SERVICE_URL"] = cls._get_endpoint_for(
            auth, "orchestration")
        os.environ["NOVA_SERVICE_URL"] = cls._get_endpoint_for(auth, "compute")
        os.environ["GLANCE_SERVICE_URL"] = cls._get_endpoint_for(auth, "image")
        images = cls.os_admin.image_client_v2.list_images()["images"]
        for img in images:
            name = img["name"]
            if name.startswith("cirros") and name.endswith("-uec"):
                os.environ["GLANCE_IMAGE_NAME"] = name
                break
        else:
            cls.skipException("A cirros-.*-uec image is required")
Esempio n. 10
0
def load_tests(loader, tests, pattern):
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              host=None,
                              intercept=fixtures.setup_app,
                              fixture_module=py_fixtures)
Esempio n. 11
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              url=TARGET_URL,
                              response_handlers=[handler.CompareHandler])
Esempio n. 12
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              prefix='/telemetry',
                              intercept=fixtures.setup_app,
                              fixture_module=fixtures)
Esempio n. 13
0
    def resource_setup(cls):
        super(TestAutoscalingGabbi, cls).resource_setup()
        test_dir = os.path.join(os.path.dirname(__file__), '..', '..',
                                'integration', 'gabbi', 'gabbits-live')
        cls.tests = driver.build_tests(
            test_dir, unittest.TestLoader(),
            host='localhost', port='13245',
            test_loader_name='tempest.scenario.telemetry-autoscaling.test')

        auth = cls.os_admin.auth_provider.get_auth()
        os.environ["ADMIN_TOKEN"] = auth[0]
        os.environ["AODH_SERVICE_URL"] = cls._get_endpoint_for(
            auth, "alarming_plugin")
        os.environ["GNOCCHI_SERVICE_URL"] = cls._get_endpoint_for(
            auth, "metric")
        os.environ["HEAT_SERVICE_URL"] = cls._get_endpoint_for(
            auth, "orchestration")
        os.environ["NOVA_SERVICE_URL"] = cls._get_endpoint_for(auth, "compute")
        os.environ["GLANCE_SERVICE_URL"] = cls._get_endpoint_for(auth, "image")
        images = cls.os_admin.image_client_v2.list_images()["images"]
        for img in images:
            name = img["name"]
            # devstack or tempest format
            if ((name.startswith("cirros") and name.endswith("-uec")) or
                    name == 'scenario-img'):
                os.environ["GLANCE_IMAGE_NAME"] = name
                break

        else:
            cls.skipException("A cirros-.*-uec/cirros image is required")
Esempio n. 14
0
 def test_build_url_target(self):
     suite = driver.build_tests(self.test_dir, self.loader,
                                host='localhost', port='999',
                                url='https://example.com:1024/theend')
     first_test = suite._tests[0]._tests[0]
     full_url = first_test._parse_url(first_test.test_data['url'])
     self.assertEqual('https://example.com:1024/theend/', full_url)
Esempio n. 15
0
    def test_build_require_ssl(self):
        suite = driver.build_tests(self.test_dir,
                                   self.loader,
                                   host='localhost',
                                   require_ssl=True)
        first_test = suite._tests[0]._tests[0]
        full_url = first_test._parse_url(first_test.test_data['url'])
        self.assertEqual('https://localhost:8001/', full_url)

        suite = driver.build_tests(self.test_dir,
                                   self.loader,
                                   host='localhost',
                                   require_ssl=False)
        first_test = suite._tests[0]._tests[0]
        full_url = first_test._parse_url(first_test.test_data['url'])
        self.assertEqual('http://localhost:8001/', full_url)
Esempio n. 16
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process.
    """
    test_dir = os.path.join(os.path.dirname(__file__), TEST_DIR)
    # Use localhost as the host paramerter, this is requried but never used
    return driver.build_tests(test_dir, loader,
    	host="127.0.0.1")
Esempio n. 17
0
def load_tests(loader, tests, pattern):
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              host=None,
                              intercept=fixtures.setup_app,
                              fixture_module=py_fixtures)
Esempio n. 18
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              host='google.com',
                              fixture_module=sys.modules[__name__],
                              port=443)
Esempio n. 19
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    host = os.getenv('GNOCCHI_SERVICE_HOST')
    if host:
        test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
        port = os.getenv('GNOCCHI_SERVICE_PORT', 8041)
        return driver.build_tests(test_dir, loader,
                                  host=host, port=port)
Esempio n. 20
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    # Pass "require_ssl=True" as an argument to force all tests
    # to use SSL in requests.
    return driver.build_tests(test_dir, loader,
                              intercept=wsgiapp.app,
                              fixture_module=fixtures)
Esempio n. 21
0
 def test_driver_prefix(self):
     suite = driver.build_tests(self.test_dir, self.loader,
                                host='localhost', port=8001,
                                prefix='/mountpoint')
     the_one_test = suite._tests[0]._tests[0]
     the_two_test = suite._tests[0]._tests[1]
     self.assertEqual('/mountpoint', the_one_test.prefix)
     self.assertEqual('/mountpoint', the_two_test.prefix)
Esempio n. 22
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              test_loader_name=__name__,
                              fixture_module=fixtures,
                              url='http://127.0.0.1/')
Esempio n. 23
0
    def test_build_url_use_prior_test(self):
        suite = driver.build_tests(self.test_dir, self.loader,
                                   host='localhost',
                                   use_prior_test=True)
        for test in suite._tests[0]._tests:
            if test.test_data['name'] != 'use_prior_false':
                expected_use_prior = True
            else:
                expected_use_prior = False

            self.assertEqual(expected_use_prior,
                             test.test_data['use_prior_test'])

        suite = driver.build_tests(self.test_dir, self.loader,
                                   host='localhost',
                                   use_prior_test=False)
        for test in suite._tests[0]._tests:
            self.assertEqual(False, test.test_data['use_prior_test'])
Esempio n. 24
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    # Pass "require_ssl=True" as an argument to force all tests
    # to use SSL in requests.
    return driver.build_tests(test_dir,
                              loader,
                              intercept=wsgiapp.app,
                              fixture_module=fixtures)
Esempio n. 25
0
 def test_build_url_target(self):
     suite = driver.build_tests(self.test_dir,
                                self.loader,
                                host='localhost',
                                port='999',
                                url='https://example.com:1024/theend')
     first_test = suite._tests[0]._tests[0]
     full_url = first_test._parse_url(first_test.test_data['url'])
     self.assertEqual('https://example.com:1024/theend/', full_url)
def load_tests(loader, tests, pattern):
    headers = {'Content-Type': 'application/json'}
    session = requests.session()
    r = session.get('http://0.0.0.0:8000/api/v1/stack/869470f2/filters/', headers=headers, auth=('*****@*****.**', 'cremacuban0!'))
    os.environ['GABBI_AUTH'] = r.request.headers['Authorization']

    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host='localhost', port=8000)
Esempio n. 27
0
def load_tests(loader, tests, pattern):
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(
        test_dir,
        loader,
        host=None,
        intercept=fixtures.setup_app,
        fixture_module=hash_fixtures,
        response_handlers=[cloudkitty_handlers.EnvironStoreHandler])
Esempio n. 28
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    
    test_dir = os.path.join(os.path.dirname(__file__), name)
    return driver.build_tests(test_dir, loader,
                              host=data['host'],
                              port=data['port'],
                              prefix=data['prefix'],
                              fixture_module=fixtures)
Esempio n. 29
0
def load_tests(loader, tests, pattern):
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              host=None,
                              intercept=simple_wsgi.SimpleWsgi,
                              fixture_module=sys.modules[__name__],
                              inner_fixtures=[InnerFixture],
                              test_loader_name=__name__)
Esempio n. 30
0
 def test_build_with_url_provides_host(self):
     """This confirms that url provides the required host."""
     suite = driver.build_tests(self.test_dir, self.loader,
                                url='https://foo.example.com')
     first_test = suite._tests[0]._tests[0]
     full_url = first_test._parse_url(first_test.test_data['url'])
     ssl = first_test.test_data['ssl']
     self.assertEqual('https://foo.example.com/', full_url)
     self.assertTrue(ssl)
Esempio n. 31
0
    def loadTestsFromModule(self, module):
        """Load Gabbits from the Module
        """
        TESTS_DIR = 'gabbits'

        test_dir = os.path.join(os.path.dirname(module.__file__), TESTS_DIR)
        tests = driver.build_tests(test_dir, defaultTestLoader,
                                   host='localhost', port=8000)
        yield tests
Esempio n. 32
0
def load_tests(loader, tests, pattern):
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              host=None,
                              intercept=fixtures.setup_app,
                              fixture_module=hash_fixtures,
                              response_handlers=[
                                  handlers.EnvironStoreHandler])
Esempio n. 33
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    # Set and environment variable for one of the tests.
    util.set_test_environ()

    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader,
                              test_loader_name=__name__,
                              **BUILD_TEST_ARGS)
Esempio n. 34
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    # Set and environment variable for one of the tests.
    os.environ['GABBI_TEST_URL'] = 'takingnames'
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              intercept=simple_wsgi.SimpleWsgi,
                              fixture_module=sys.modules[__name__],
                              response_handlers=[TestResponseHandler])
Esempio n. 35
0
 def test_build_with_url_provides_host(self):
     """This confirms that url provides the required host."""
     suite = driver.build_tests(self.test_dir,
                                self.loader,
                                url='https://foo.example.com')
     first_test = suite._tests[0]._tests[0]
     full_url = first_test._parse_url(first_test.test_data['url'])
     ssl = first_test.test_data['ssl']
     self.assertEqual('https://foo.example.com/', full_url)
     self.assertTrue(ssl)
def load_tests(loader, tests, pattern):
    headers = {'Content-Type': 'application/json'}
    session = requests.session()
    r = session.get('http://0.0.0.0:8000/api/v1/stack/869470f2/filters/',
                    headers=headers,
                    auth=('*****@*****.**', 'cremacuban0!'))
    os.environ['GABBI_AUTH'] = r.request.headers['Authorization']
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host='localhost', port=8000)
Esempio n. 37
0
 def test_driver_prefix(self):
     suite = driver.build_tests(self.test_dir,
                                self.loader,
                                host='localhost',
                                port=8001,
                                prefix='/mountpoint')
     the_one_test = suite._tests[0]._tests[0]
     the_two_test = suite._tests[0]._tests[1]
     self.assertEqual('/mountpoint', the_one_test.prefix)
     self.assertEqual('/mountpoint', the_two_test.prefix)
Esempio n. 38
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    # Set and environment variable for one of the tests.
    util.set_test_environ()

    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              test_loader_name=__name__,
                              **BUILD_TEST_ARGS)
Esempio n. 39
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process
    """
    
    test_dir = os.path.join(os.path.dirname(__file__), name)
    return driver.build_tests(test_dir, loader,
                              host=data['host'],
                              port=data['port'],
                              prefix=data['prefix'],
                              fixture_module=fixtures)
Esempio n. 40
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    # Set and environment variable for one of the tests.
    os.environ['GABBI_TEST_URL'] = 'takingnames'
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir,
                              loader,
                              host=None,
                              intercept=simple_wsgi.SimpleWsgi,
                              fixture_module=sys.modules[__name__],
                              response_handlers=[TestResponseHandler])
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(
        test_dir,
        loader,
        host=None,
        prefix="/telemetry",
        intercept=app.VersionSelectorApplication,
        fixture_module=fixture_module,
    )
Esempio n. 42
0
    def test_build_url_use_prior_test(self):
        suite = driver.build_tests(self.test_dir,
                                   self.loader,
                                   host='localhost',
                                   use_prior_test=True)
        for test in suite._tests[0]._tests:
            if test.test_data['name'] != 'use_prior_false':
                expected_use_prior = True
            else:
                expected_use_prior = False

            self.assertEqual(expected_use_prior,
                             test.test_data['use_prior_test'])

        suite = driver.build_tests(self.test_dir,
                                   self.loader,
                                   host='localhost',
                                   use_prior_test=False)
        for test in suite._tests[0]._tests:
            self.assertEqual(False, test.test_data['use_prior_test'])
Esempio n. 43
0
 def test_driver_loads_one_test(self):
     suite = driver.build_tests(self.test_dir,
                                self.loader,
                                host='localhost',
                                port=8001)
     self.assertEqual(1, len(suite._tests),
                      'top level suite contains one suite')
     self.assertEqual(1, len(suite._tests[0]._tests),
                      'contained suite contains one test')
     self.assertEqual('test_driver_single_one',
                      suite._tests[0]._tests[0].__class__.__name__,
                      'test class name maps')
Esempio n. 44
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    # Set and environment variable for one of the tests.
    util.set_test_environ()

    prefix = os.environ.get('GABBI_PREFIX')
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              intercept=simple_wsgi.SimpleWsgi,
                              test_loader_name=__name__,
                              prefix=prefix,
                              fixture_module=sys.modules[__name__],
                              response_handlers=[TestResponseHandler])
Esempio n. 45
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    # These inner fixtures provide per test request output and log
    # capture, for cleaner results reporting.
    inner_fixtures = [
        placement_fixtures.OutputStreamCapture,
        placement_fixtures.StandardLogging,
    ]
    return driver.build_tests(test_dir, loader, host=None,
                              test_loader_name=__name__,
                              intercept=fixtures.setup_app,
                              inner_fixtures=inner_fixtures,
                              fixture_module=fixtures)
Esempio n. 46
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    # These inner fixtures provide per test request output and log
    # capture, for cleaner results reporting.
    inner_fixtures = [
        nova_fixtures.OutputStreamCapture,
        nova_fixtures.StandardLogging,
    ]
    return driver.build_tests(test_dir, loader, host=None,
                              test_loader_name=__name__,
                              intercept=fixtures.setup_app,
                              inner_fixtures=inner_fixtures,
                              fixture_module=fixtures)
Esempio n. 47
0
 def test_driver_loads_two_tests(self):
     suite = driver.build_tests(self.test_dir, self.loader,
                                host='localhost', port=8001)
     self.assertEqual(1, len(suite._tests),
                      'top level suite contains one suite')
     self.assertEqual(2, len(suite._tests[0]._tests),
                      'contained suite contains two tests')
     the_one_test = suite._tests[0]._tests[0]
     self.assertEqual('test_driver_sample_one',
                      the_one_test.__class__.__name__,
                      'test class name maps')
     self.assertEqual('one',
                      the_one_test.test_data['name'])
     self.assertEqual('/', the_one_test.test_data['url'])
Esempio n. 48
0
 def test_driver_loads_two_tests(self):
     suite = driver.build_tests(self.test_dir,
                                self.loader,
                                host='localhost',
                                port=8001)
     self.assertEqual(1, len(suite._tests),
                      'top level suite contains one suite')
     self.assertEqual(2, len(suite._tests[0]._tests),
                      'contained suite contains two tests')
     the_one_test = suite._tests[0]._tests[0]
     self.assertEqual('test_driver_sample_one',
                      the_one_test.__class__.__name__,
                      'test class name maps')
     self.assertEqual('one', the_one_test.test_data['name'])
     self.assertEqual('/', the_one_test.test_data['url'])
Esempio n. 49
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    NEEDED_ENV = ["AODH_SERVICE_URL", "GNOCCHI_SERVICE_URL",
                  "HEAT_SERVICE_URL", "NOVA_SERVICE_URL", "PANKO_SERVICE_URL",
                  "GLANCE_IMAGE_NAME", "ADMIN_TOKEN"]

    for env_variable in NEEDED_ENV:
        if not os.getenv(env_variable):
            if os.getenv("GABBI_LIVE_FAIL_IF_NO_TEST"):
                raise RuntimeError('%s is not set' % env_variable)
            else:
                return

    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host="localhost", port=8041)
Esempio n. 50
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    NEEDED_ENV = ["AODH_SERVICE_URL", "GNOCCHI_SERVICE_URL",
                  "HEAT_SERVICE_URL", "NOVA_SERVICE_URL",
                  "GLANCE_IMAGE_NAME", "ADMIN_TOKEN"]

    for env_variable in NEEDED_ENV:
        if not os.getenv(env_variable):
            if os.getenv("GABBI_LIVE_FAIL_IF_NO_TEST"):
                raise RuntimeError('%s is not set' % env_variable)
            else:
                return

    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host="localhost", port=8041)
Esempio n. 51
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)

    conf = config.CONF.heat_plugin
    if conf.auth_url is None:
        # It's not configured, let's not load tests
        return
    manager = clients.ClientManager(conf)
    endpoint = manager.identity_client.get_endpoint_url(
        'orchestration', region=conf.region, endpoint_type=conf.endpoint_type)
    host = urlparse.urlparse(endpoint).hostname
    os.environ['OS_TOKEN'] = manager.identity_client.auth_token
    os.environ['PREFIX'] = test.rand_name('api')

    return driver.build_tests(test_dir, loader, host=host,
                              url=endpoint, test_loader_name=__name__)
Esempio n. 52
0
    def resource_setup(cls):
        super(GnocchiGabbiTest, cls).resource_setup()
        url, token = cls._get_gnocchi_auth()
        parsed_url = urlparse.urlsplit(url)
        prefix = parsed_url.path.rstrip('/')  # turn it into a prefix
        port = 443 if parsed_url.scheme == 'https' else 80
        host = parsed_url.hostname
        if parsed_url.port:
            port = parsed_url.port

        test_dir = os.path.join(os.path.dirname(__file__), '..', '..',
                                'tests', 'gabbi', 'gabbits-live')
        cls.tests = driver.build_tests(
            test_dir, unittest.TestLoader(),
            host=host, port=port, prefix=prefix,
            test_loader_name='tempest.scenario.gnocchi.test')

        os.environ["GNOCCHI_SERVICE_TOKEN"] = token
Esempio n. 53
0
    def _build_gabbi_testsuite(self, url_override=None):
        # build gabbi test suite
        top_testsuite = \
            driver.build_tests(self.gabbit_path,
                               unittest.TestLoader(),
                               host='localhost',
                               response_handlers=[
                                   handlers.StoreHeadersResponseHandler],
                               content_handlers=[
                                   handlers.StoreResponseValueHandler],
                               url=url_override if url_override else self.url,
                               test_loader_name='dummy',
                               use_prior_test=False)

        # save each testcase name and object in dictionary
        for testsuite in top_testsuite:
            for tc in testsuite:
                # strip out filename prefix
                filename, method = type(tc).__name__.split('_', 1)
                self.testcases[method] = tc
Esempio n. 54
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    global TEST_DIR

    return driver.build_tests(
        TEST_DIR,
        loader,
        host='localhost',
        url=os.environ.get('DECKHAND_TEST_URL', '127.0.0.1:9000'),
        # NOTE(felipemonteiro): When there are multiple handlers listed that
        # accept the same content-type, the one that is earliest in the list
        # will be used. Thus, we cannot specify multiple content handlers for
        # handling list/dictionary responses from the server using different
        # handlers.
        content_handlers=[
            core.StringResponseHandler,  # For parsing text/plain
            jsonhandler.JSONHandler,  # For parsing application/json
            MultidocJsonpaths  # For parsing application/x-yaml
        ],
        verbose=True)
Esempio n. 55
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    gnocchi_url = os.getenv('GNOCCHI_ENDPOINT')
    if gnocchi_url:
        parsed_url = urlparse.urlsplit(gnocchi_url)
        prefix = parsed_url.path.rstrip('/')  # turn it into a prefix

        # NOTE(chdent): gabbi requires a port be passed or it will
        # default to 8001, so we must dance a little dance to get
        # the right ports. Probably gabbi needs to change.
        # https://github.com/cdent/gabbi/issues/50
        port = 443 if parsed_url.scheme == 'https' else 80
        if parsed_url.port:
            port = parsed_url.port

        test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
        return driver.build_tests(test_dir, loader,
                                  host=parsed_url.hostname,
                                  port=port,
                                  prefix=prefix)
    elif os.getenv("GABBI_LIVE"):
        raise RuntimeError('"GNOCCHI_ENDPOINT" is not set')
Esempio n. 56
0
    def resource_setup(cls):
        super(GenericGabbiTest, cls).resource_setup()

        cls._set_environ()

        # We support all enabled services, so use base hosts.
        host = 'stub'
        url = None

        fallback_dir = os.path.join(os.getcwd(), 'gabbits')
        gabbi_paths = os.environ.get('GABBI_TEMPEST_PATH', fallback_dir)

        top_suite = unittest.TestSuite()

        for test_dir in gabbi_paths.split(':'):
            dotted_path = test_dir.replace(os.path.sep, '.')
            inner_suite = driver.build_tests(
                    test_dir, unittest.TestLoader(), host=host, url=url,
                    test_loader_name='tempest.scenario%s' % dotted_path)
            top_suite.addTest(inner_suite)

        cls.tests = top_suite
Esempio n. 57
0
 def test_build_requires_host_or_intercept(self):
     with self.assertRaises(AssertionError):
         driver.build_tests(self.test_dir, self.loader)
Esempio n. 58
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host='google.com',
                              fixture_module=sys.modules[__name__],
                              port=443)
Esempio n. 59
0
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader, host=None,
                              intercept=blogstrap.create_app,
                              fixture_module=sys.modules[__name__])
def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(
        test_dir, loader, test_loader_name=__name__, intercept=app)