def setUpClass(cls): cls.prefix = prefix or rand() cls.context = Context(user=user, password=password, api=api) cls.context_public = cls.context # Initialize platform and check access cls.platform = QubellPlatform(context=cls.context) assert cls.platform.authenticate() cls.platform_public = QubellPlatformPublic(context=cls.context_public) # Set default manifest for app creation cls.manifest = Manifest(file=os.path.join(os.path.dirname(__file__), 'default.yml'), name='BaseTestManifest') # Initialize organization cls.organization = cls.platform.organization(name=org) cls.organization_public = cls.platform_public.organization(name=org) if zone: z = [x for x in cls.organization.list_zones() if x['name'] == zone] if z: cls.organization.zoneId = z[0]['id'] # Initialize environment if zone: cls.environment = cls.organization.environment( name='default', zone=cls.organization.zoneId) cls.environment.set_backend(cls.organization.zoneId) else: cls.environment = cls.organization.environment(name='default') cls.environment_public = cls.organization_public.environment( id=cls.environment.environmentId) cls.shared_service = cls.organization.service( name='BaseTestSharedService' + zone) cls.wf_service = cls.organization.service(name='Workflow' + zone) cls.key_service = cls.organization.service(name='Keystore' + zone) # Cannot get services by Name (list not imlpemented) cls.shared_service_public = cls.organization_public.service( id=cls.shared_service.serviceId) cls.wf_service_public = cls.organization_public.service( id=cls.wf_service.serviceId) cls.key_service_public = cls.organization_public.service( id=cls.key_service.serviceId)
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"
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 timeout(cls): return 40 @classmethod def environment(cls, organization): base_env = super(BaseComponentTestCase, cls).environment(organization)