Esempio n. 1
0
def start():
    # Here we check existance of given credentials and create services if needed
    print "Creating ENV"
    exit = 0
    if not user:
        log.error('No username provided. Set QUBELL_USER env')
        exit = 1
    if not password:
        log.error('No password provided. Set QUBELL_PASSWORD env')
        exit = 1
    if not api:
        log.error('No api url provided. Set QUBELL_API env')
        exit = 1

    if exit:
        sys.exit(1)


# Setup access
    context = Context(user=user, password=password, api=api)

    # Initialize platform and check access
    platform = QubellPlatform(context=context)
    assert platform.authenticate()
    print "Authorization passed"
    # Initialize organization
    organization = platform.organization(name=org)
    print "Using orgainzation %s" % org

    if zone:  # Need to run tests against zones. Create env for each
        z = [x for x in organization.list_zones() if x['name'] == zone]
        if len(z):
            print "Using zone %s" % zone
            create_env(organization, z[0]['id'])

    create_env(organization)
    create_launcher_apps(organization)
    print "ENV created"
def start():
# Here we check existance of given credentials and create services if needed
    print "Creating ENV"
    exit = 0
    if not user:
        log.error('No username provided. Set QUBELL_USER env')
        exit = 1
    if not password:
        log.error('No password provided. Set QUBELL_PASSWORD env')
        exit = 1
    if not tenant:
        log.error('No api url provided. Set QUBELL_TENANT env')
        exit = 1

    if exit:
        sys.exit(1)

# Setup access
    auth = Auth(user=user, password=password, tenant=tenant)

# Initialize platform and check access
    platform = QubellPlatform(auth=auth)
    assert platform.authenticate()
    print "Authorization passed"
# Initialize organization
    organization = platform.organization(name=org)
    print "Using orgainzation %s" % org

    if zone: # Need to run tests against zones. Create env for each
        z = [x for x in organization.list_zones() if x['name'] == zone]
        if len(z):
            print "Using zone %s" % zone
            create_env(organization, z[0]['id'])

    create_env(organization)
    create_launcher_apps(organization)
    print "ENV created"
Esempio n. 3
0
parameters = {
    'organization': os.getenv('QUBELL_ORGANIZATION', None),
    'user': os.environ['QUBELL_USER'],
    'pass': os.environ['QUBELL_PASS'],
    'tenant': os.environ['QUBELL_TENANT'],
    'provider_name': os.getenv('PROVIDER_NAME', "test-provider"),
    'provider_type': os.environ['PROVIDER_TYPE'],
    'provider_identity': os.environ['PROVIDER_IDENTITY'],
    'provider_credential': os.environ['PROVIDER_CREDENTIAL'],
    'provider_region': os.environ['PROVIDER_REGION']
}

context = Context(user=parameters['user'], password=parameters['pass'], api=parameters['tenant'])
platform = QubellPlatform(context=context)
assert platform.authenticate()


class BaseComponentTestCase(BaseTestCase):
    platform = platform
    parameters = parameters
    apps = []

    @classmethod
    def environment(cls, organization):
        base_env = super(BaseComponentTestCase, cls).environment(organization)

        base_env['applications'] = cls.apps

        return base_env
    'organization': os.getenv('QUBELL_ORGANIZATION', None),
    'user': os.environ['QUBELL_USER'],
    'pass': os.environ['QUBELL_PASS'],
    'tenant': os.environ['QUBELL_TENANT'],
    'provider_name': os.getenv('PROVIDER_NAME', "test-provider"),
    'provider_type': os.environ['PROVIDER_TYPE'],
    'provider_identity': os.environ['PROVIDER_IDENTITY'],
    'provider_credential': os.environ['PROVIDER_CREDENTIAL'],
    'provider_region': os.environ['PROVIDER_REGION']
}

context = Context(user=parameters['user'],
                  password=parameters['pass'],
                  api=parameters['tenant'])
platform = QubellPlatform(context=context)
assert platform.authenticate()


class BaseComponentTestCase(BaseTestCase):
    platform = platform
    parameters = parameters
    apps = []

    @classmethod
    def timeout(cls):
        return 40

    @classmethod
    def environment(cls, organization):
        base_env = super(BaseComponentTestCase, cls).environment(organization)