예제 #1
0
    def test_parameter_added(self):
        """ Reconfigure app adding new parameter. New parameter should be shown after reconfiguration.
        """
        src = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "workflow-removed_param.yml"))
        dst = Manifest(
            file=os.path.join(os.path.dirname(__file__), "workflow-base.yml"))
        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        @retry(5, 2, 1)
        def waitFor():
            return reconfigured_inst.returnValues.has_key('out.app_output')

        waitFor()
        self.assertEqual("Hello from BASE WORKFLOW manifest",
                         reconfigured_inst.returnValues['out.app_output'])

        self.assertTrue(
            self.inst1.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst1.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
예제 #2
0
    def test_launch_hierapp_shared_instance(self):
        """ Launch hierarchical app with shared instance.
        """

        pmnf = Manifest(file=os.path.join(os.path.dirname(__file__), "parent_child1.yml")) #Todo: resolve paths
        pmnf.patch('application/components/child/configuration/__locator.application-id', self.child_one.applicationId)

        parameters = {self.child_one.name: {'revisionId': self.child_one_revision.revisionId}}

        # Api BUG?? TODO
        parameters = {
                "parent_in.child_input": "Hello from parent to child"}
        submodules = {
                "child": {
                    "revisionId": self.child_one_revision.revisionId}}


        self.parent.upload(pmnf)
        parent_instance = self.parent.launch(destroyInterval=600000, parameters=parameters, submodules=submodules)
        self.assertTrue(parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))

        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        self.assertEqual(parent_instance.submodules[0]['id'], self.child_one_instance.instanceId)

        # Shouldn't be able to remove child while parent use it and should return error
        # TODO: BUG
        #self.assertFalse(child_instance.destroy())

        self.assertTrue(parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
예제 #3
0
    def test_parameter_removed(self):
        """ Reconfigure app removing parameter. Old parameter should disappear after reconfiguration.
        """
        src = Manifest(
            file=os.path.join(os.path.dirname(__file__), "workflow-base.yml"))
        dst = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "workflow-removed_param.yml"))

        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        @retry(5, 2, 1)
        def waitFor():
            return not reconfigured_inst.returnValues.has_key('out.app_output')

        waitFor()
        self.assertFalse(
            reconfigured_inst.returnValues.has_key('out.app_output'))

        self.assertTrue(
            self.inst1.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst1.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
    def test_servicecall_hierapp(self):
        """ Launch hierarchical with non shared instance and execute service call on child.
        """

        pmnf = Manifest(file=os.path.join(os.path.dirname(__file__), "parent_servicecall.yml")) #Todo: resolve paths
        pmnf.patch('application/components/child/configuration/__locator.application-id', self.child.applicationId)
        self.parent.upload(pmnf)

        parent_instance = self.parent.launch(destroyInterval=600000)
        self.assertTrue(parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))

        self.assertTrue(parent_instance.submodules, 'Parent does not start submodules')
        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        sub = parent_instance.submodules

        self.assertFalse(len([sid for sid in sub if sid['id'] == self.child_instance.instanceId]))  # Way i search for id

    # Instance ready. Execute workflow with servicecall

        parent_instance.runWorkflow(name='actions.child_servicecall')
        self.assertTrue(parent_instance.ready(), "Parent instance failed to execute servicall workflow")
        sleep(10)
        self.assertEqual('child Update launched', parent_instance.returnValues['parent_out.child_workflow_status'])



        # Shouldn't be able to remove child while parent use it and should return error
        # TODO: BUG
        #self.assertFalse(child_instance.destroy())

        self.assertTrue(parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
    def test_smart_application_method(self):
        org = self.org
        app = self.app
        base_app = org.get_or_create_application(name='Self-smart_application_method', manifest=app.manifest)

        # Get application
        self.assertEqual(base_app, org.application(name='Self-smart_application_method'))
        self.assertEqual(base_app, org.application(id=base_app.id))
        self.assertEqual(base_app, org.application(id=base_app.id, name='Self-smart_application_method'))

        # Modify application
        new_name_app = org.application(id=base_app.id, name='Self-smart_application_method-new-name')
        self.assertEqual(base_app, new_name_app)
        self.assertEqual('Self-smart_application_method-new-name', new_name_app.name)

        new_manifest = Manifest(file=os.path.join(os.path.dirname(__file__), 'default.yml'), name='Updated')
        new_manifest.patch('application/configuration/in.app_input', 'NEW NEW')
        new_name_app = org.application(id=base_app.id, manifest=new_manifest)
        self.assertEqual(base_app, new_name_app)
        self.assertTrue('NEW NEW' in base_app.get_manifest()['manifest'])

        # Create application
        new_application = org.application(name='Self-smart_application_method-create', manifest=app.manifest)
        self.assertEqual('Self-smart_application_method-create', new_application.name)
        self.assertTrue(new_application in org.applications)
        self.assertTrue(new_application.delete())

        # Clean
        self.assertTrue(base_app.delete())
예제 #6
0
    def setUpClass(cls):
        super(ServiceCallTestApp, cls).setUpClass()

        # Create applications for tests
        cls.parent = cls.organization.application(
            name="%s-test-servicecall-parent" % cls.prefix,
            manifest=cls.manifest)
        cls.child = cls.organization.application(
            name="%s-test-servicecall-child" % cls.prefix,
            manifest=cls.manifest)

        # Create non shared instance to use in tests
        mnf = Manifest(
            file=os.path.join(os.path.dirname(__file__), 'child.yml'))
        mnf.patch(
            'application/components/child_app/configuration/configuration.workflows/launch/return/own/value',
            'Service call child')
        cls.child.upload(mnf)
        cls.child_instance = cls.child.launch(destroyInterval=600000)
        assert cls.child_instance
        assert cls.child_instance.ready()
        cls.child_revision = cls.child.create_revision(
            name='%s-tests-servicecall-shared' % cls.prefix,
            instance=cls.child_instance)

        cls.shared_service.add_shared_instance(cls.child_revision,
                                               cls.child_instance)
def prepare_monitor(tenant=tenant,
                    user=user,
                    password=password,
                    organization=organization,
                    zone_name=zone_name):
    """
    :param tenant: tenant url
    :param user: user's email
    :param password: user's password
    :param zone_name: (optional) zone_name
    :return:
    """
    router = PrivatePath(tenant, verify_codes=False)

    payload = {
        "firstName": "AllSeeingEye",
        "lastName": "Monitor",
        "email": user,
        "password": password,
        "accept": "true"
    }
    try:
        router.post_quick_sign_up(data=payload)
    except exceptions.ApiUnauthorizedError:
        pass

    platform = QubellPlatform.connect(tenant=tenant,
                                      user=user,
                                      password=password)
    org = platform.organization(name=organization)
    if zone_name:
        zone = org.zones[zone_name]
    else:
        zone = org.zone
    env = org.environment(name="Monitor for " + zone.name, zone=zone.id)
    env.init_common_services(with_cloud_account=False, zone_name=zone_name)

    # todo: move to env
    policy_name = lambda policy: "{}.{}".format(policy.get('action'),
                                                policy.get('parameter'))
    env_data = env.json()
    key_id = [
        p for p in env_data['policies']
        if 'provisionVms.publicKeyId' == policy_name(p)
    ][0].get('value')

    with env as envbulk:
        envbulk.add_marker('monitor')
        envbulk.add_property('publicKeyId', 'string', key_id)

    monitor = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         './monitor_manifests/monitor.yml'))
    monitor_child = Manifest(file=os.path.join(
        os.path.dirname(__file__), './monitor_manifests/monitor_child.yml'))

    org.application(manifest=monitor_child, name='monitor-child')
    app = org.application(manifest=monitor, name='monitor')

    return platform, org.id, app.id, env.id
 def test_upload_not_valid_manifest(self):
     """ Check uploading non-validatable manifest to application returns error
     """
     badm = Manifest()
     badm.content = """
     application:
       components:
         error:
     """
     self.assertFalse(self.app_public.upload(badm), 'Succeed uploading unvalidatable manifest')
예제 #9
0
    def test_servicecall_hierapp_with_shared_child(self):
        """ Launch hierarchical app with shared instance and execute service call on child.
        """

        pmnf = Manifest(
            file=os.path.join(os.path.dirname(__file__),
                              "parent_servicecall.yml"))  #Todo: resolve paths
        pmnf.patch(
            'application/components/child/configuration/__locator.application-id',
            self.child.applicationId)
        self.parent.upload(pmnf)

        submodules = {"child": {"revisionId": self.child_revision.revisionId}}

        parent_instance = self.parent.launch(destroyInterval=600000,
                                             submodules=submodules)
        self.assertTrue(
            parent_instance, "%s-%s: Instance failed to launch" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            parent_instance.ready(),
            "%s-%s: Instance not in 'running' state after timeout" %
            (self.prefix, self._testMethodName))

        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        sub = parent_instance.submodules

        self.assertTrue(
            len([
                sid for sid in sub
                if sid['id'] == self.child_instance.instanceId
            ]))  # Way i search for id

        # Instance ready. Execute workflow with servicecall

        parent_instance.runWorkflow(name='actions.child_servicecall')
        self.assertTrue(
            parent_instance.ready(),
            "Parent instance failed to execute servicall workflow")
        sleep(10)
        self.assertEqual(
            'child Update launched',
            parent_instance.returnValues['parent_out.child_workflow_status'])

        # Shouldn't be able to remove child while parent use it and should return error
        # TODO: BUG
        #self.assertFalse(child_instance.destroy())

        self.assertTrue(
            parent_instance.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            parent_instance.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
 def test_upload_not_valid_manifest(self):
     """ Check uploading non-validatable manifest to application returns error
     """
     badm = Manifest()
     badm.content = """
     application:
       components:
         error:
     """
     self.assertFalse(self.app_public.upload(badm),
                      'Succeed uploading unvalidatable manifest')
예제 #11
0
    def test_parameter_type_change(self):
        """ Reconfigure app changing parameter type.
        """
        src = Manifest(
            file=os.path.join(os.path.dirname(__file__), "constants-base.yml"))
        dst = Manifest(file=os.path.join(
            os.path.dirname(__file__), "constants-parameter_type_change.yml"))
        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        self.assertEqual("42", reconfigured_inst.returnValues['return.foo'])
예제 #12
0
    def test_parameter_removed(self):
        """ Reconfigure app removing parameter. Old returns should be removed after reconfiguration.
        """
        src = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "constants-added_parameter.yml"))
        dst = Manifest(
            file=os.path.join(os.path.dirname(__file__), "constants-base.yml"))
        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        self.assertEqual("Hello single param",
                         reconfigured_inst.returnValues['return.foo'])
        self.assertFalse(reconfigured_inst.returnValues.has_key('return.bar'))
예제 #13
0
    def test_parameter_added(self):
        """ Reconfigure app adding new parameter. It should be shown after reconfiguration.
        """
        src = Manifest(
            file=os.path.join(os.path.dirname(__file__), "constants-base.yml"))
        dst = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "constants-added_parameter.yml"))
        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        self.assertEqual("Hello old param",
                         reconfigured_inst.returnValues['return.foo'])
        self.assertEqual("Hello NEW param",
                         reconfigured_inst.returnValues['return.bar'])
예제 #14
0
    def test_workflow_added(self):
        """ Reconfigure app with adding action to workflow.
        """
        src = Manifest(
            file=os.path.join(os.path.dirname(__file__), "workflow-base.yml"))
        dst = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "workflow-many_changes.yml"))

        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        @retry(5, 2, 1)
        def waitFor():
            return reconfigured_inst.returnValues.has_key('out.new_output')

        waitFor()

        self.assertEqual("Hello from BASE WORKFLOW manifest",
                         reconfigured_inst.returnValues['out.app_output'])
        self.assertTrue(
            'action.stop' in
            [x['name'] for x in reconfigured_inst.availableWorkflows])
        self.assertTrue(
            'action.gogo_new' in
            [x['name'] for x in reconfigured_inst.availableWorkflows])

        reconfigured_inst.runWorkflow(name='action.gogo_new')
        self.assertTrue(reconfigured_inst.ready())
        self.assertEqual("Action GOGO-NEW launched",
                         reconfigured_inst.returnValues['out.new_output'])

        reconfigured_inst.runWorkflow(name='action.stop')
        self.assertTrue(reconfigured_inst.ready())
        self.assertEqual("Action STOP launched",
                         reconfigured_inst.returnValues['out.new_output'])

        self.assertTrue(
            self.inst1.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst1.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
예제 #15
0
    def test_launch_basic_non_shared_hierapp(self):
        """ Launch hierarchical app with child as not shared instance. Check that launching parent launches child instance.
        """
        pmnf = Manifest(file=os.path.join(os.path.dirname(__file__), "parent_child1.yml")) #Todo: resolve paths
        pmnf.patch('application/components/child/configuration/__locator.application-id', self.child_three.applicationId)
        self.parent.upload(pmnf)
        parent_instance = self.parent.launch(destroyInterval=300000)
        self.assertTrue(parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))

        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        self.assertNotEqual(parent_instance.submodules[0]['id'], self.child_three_instance.instanceId)

        self.assertTrue(parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
예제 #16
0
def create_launcher_apps(org):
    man = """
application:
  components:
    empty:
      type: cobalt.common.Constants
      interfaces:
        int1:
          pin1: publish-signal(string)
      configuration:
        configuration.values:
          int1.pin1: "Hello"
"""

    manifest = Manifest(content=man)
    apps = [
        'marker', 'simple-cobalt', 'starter-java-web', 'webdriver-grid',
        'hier-db', 'hier-main'
    ]
    for app in apps:
        print "creating app: %s" % app
        org.application(name=app, manifest=manifest)

    env = org.environment(name='default')
    env.markerAdd('has-internet-access')
    env.propertyAdd(name='sample-property-green', type='int', value='42')
    env.propertyAdd(name='sample-property-red',
                    type='string',
                    value='sample-property red')
    policy = {
        'action': 'provisionVms',
        'parameter': 'vmIdentity',
        'value': 'ubuntu'
    }
    env.policyAdd(policy)
    def setUpClass(cls):
        super(ThreeLevelHierarchicalAppTest, cls).setUpClass()

    # Create applications for tests
        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "child.yml"))
        cls.last_child = cls.organization.application(name="%s-test-3lhierapp-last_child" % cls.prefix, manifest=mnf)
        cls.last_child_public = cls.organization_public.get_application(id=cls.last_child.applicationId)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "middle_child.yml"))
        mnf.patch('application/components/last_child/configuration/__locator.application-id', cls.last_child.applicationId)
        cls.middle_child = cls.organization.application(name="%s-test-3lhierapp-middle-child" % cls.prefix, manifest=mnf)
        cls.middle_child_public = cls.organization_public.get_application(id=cls.middle_child.applicationId)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "super_parent.yml"))
        mnf.patch('application/components/middle_child/configuration/__locator.application-id', cls.middle_child.applicationId)
        cls.parent = cls.organization.application(name="%s-test-3lhierapp-super-parent" % cls.prefix, manifest=mnf)
        cls.parent_public = cls.organization_public.get_application(id=cls.parent.applicationId)
예제 #18
0
 def __application(self, app):
     manifest = Manifest(**{
         k: v
         for k, v in app.iteritems() if k in ["content", "url", "file"]
     })
     application = self.organization.application(manifest=manifest,
                                                 name=app["name"])
     app["id"] = application.applicationId
    def test_switch_child_shared_standalone_and_back(self):
        """ Launch hierarchical app with non shared instance. Change child to shared, check. Switch back.
        """

        # Run parent with NON shared child
        pmnf = Manifest(file=os.path.join(os.path.dirname(__file__), "hier-parent.yml"))
        pmnf.patch('application/components/child/configuration/__locator.application-id', self.child_app.applicationId)
        self.parent_app.upload(pmnf)

        parent_instance = self.parent_app.launch(destroyInterval=3000000)
        self.assertTrue(parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))


        non_shared_rev = self.parent_app.create_revision(name='non-shared-child', instance=parent_instance)

        # Ensure we use non shared instance
        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        self.assertNotEqual(parent_instance.submodules[0]['id'], self.child_instance.instanceId)

        # Reconfigure parent to use shared child
        parameters = {
            'parent_in.child_input': 'Set on reconfiguration'}
        submodules = {
            'child': {
                'revisionId': self.child_rev.revisionId}}


        self.assertTrue(parent_instance.reconfigure(parameters=parameters, submodules=submodules))

        # Check we use shared instance
        self.assertTrue(parent_instance.ready(), "Instance failed to reconfigure")
        self.assertTrue(parent_instance.submodules, 'No submodules found')
        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        self.assertEqual(parent_instance.submodules[0]['id'], self.child_instance.instanceId)

        # Switch back to non shared instance
        self.assertTrue(parent_instance.reconfigure(revisionId=non_shared_rev.revisionId))

        # Check we use shared instance again
        self.assertTrue(parent_instance.ready(), "Instance failed to reconfigure")
        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        self.assertNotEqual(parent_instance.submodules[0]['id'], self.child_instance.instanceId)

        self.assertTrue(parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
    def setUpClass(cls):
        super(ServiceCallTestApp, cls).setUpClass()

    # Create applications for tests
        cls.parent = cls.organization.application(name="%s-test-servicecall-parent" % cls.prefix, manifest=cls.manifest)
        cls.child = cls.organization.application(name="%s-test-servicecall-child" % cls.prefix, manifest=cls.manifest)

    # Create non shared instance to use in tests
        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), 'child.yml'))
        mnf.patch('application/components/child_app/configuration/configuration.workflows/launch/return/own/value', 'Service call child')
        cls.child.upload(mnf)
        cls.child_instance = cls.child.launch(destroyInterval=600000)
        assert cls.child_instance
        assert cls.child_instance.ready()
        cls.child_revision = cls.child.create_revision(name='%s-tests-servicecall-shared' % cls.prefix, instance=cls.child_instance)

        cls.shared_service.add_shared_instance(cls.child_revision, cls.child_instance)
    def test_new_child_application(self):
        """ Launch hierarchical app with child as not shared instance. Change __locator and check new child launched
        """

        # Run parent with child
        pmnf = Manifest(file=os.path.join(os.path.dirname(__file__), "hier-parent.yml"))
        pmnf.patch('application/components/child/configuration/__locator.application-id', self.child_app.applicationId)

        self.parent_app.upload(pmnf)
        parent_instance = self.parent_app.launch(destroyInterval=300000)
        self.assertTrue(parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))

        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')


        # Run parent with new_child
        pmnf.patch('application/components/child/configuration/__locator.application-id', self.new_child_app.applicationId)
        self.parent_app.upload(pmnf)
        new_parent_instance = self.parent_app.launch(destroyInterval=300000)
        self.assertTrue(new_parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(new_parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))

        self.assertEqual(new_parent_instance.submodules[0]['status'], 'Running')

        new_rev = self.parent_app.create_revision(name='tests-new-child', instance=new_parent_instance)

        # Reconfigure old parent with new revision
        parent_instance.reconfigure(revisionId=new_rev.revisionId)

        # Check results
        self.assertTrue(new_parent_instance.ready(), "Instance failed to reconfigure")
        self.assertNotEqual(parent_instance.submodules[0]['id'], new_parent_instance.submodules[0]['id'])
        self.assertEqual("Child2 welcomes you", new_parent_instance.returnValues['parent_out.child_out'])

        self.assertTrue(new_rev.delete)

        self.assertTrue(parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
        self.assertTrue(new_parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(new_parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
예제 #22
0
    def restore(self, config, clean=False, timeout=10):
        config = copy.deepcopy(config)

        for app in config.pop('applications'):
            manifest_param = dict([(k, v) for k, v in app.iteritems()
                                   if k in ["content", "url", "file"]])
            if manifest_param:
                manifest = Manifest(**manifest_param)
            else:
                manifest = None  # if application exists, manifest must be None
            self.application(id=app.pop('id', None),
                             manifest=manifest,
                             name=app.pop('name'))

        for serv in config.pop('services', []):
            app = serv.pop('application', None)
            if app:
                app = self.get_application(name=app)

            type = serv.pop('type', None)
            service = self.service(id=serv.pop('id', None),
                                   name=serv.pop('name'),
                                   type=type,
                                   application=app,
                                   parameters=serv.pop('parameters', None))
            assert service.running(timeout)

        for env in config.pop('environments', []):
            env_zone = env.pop('zone', None)
            if env_zone:
                zone_id = self.zones[env_zone].id
            elif ZONE_NAME:
                zone_id = self.zones[ZONE_NAME].id
            else:
                zone_id = None
            restored_env = self.get_or_create_environment(
                id=env.pop('id', None),
                name=env.pop('name', DEFAULT_ENV_NAME()),
                zone=zone_id,
                default=env.pop('default', False))
            restored_env.restore(env, clean, timeout)

        #todo: make launch and ready async
        for instance in config.pop('instances', []):
            launched = self.get_or_launch_instance(
                application=self.get_application(
                    name=instance.pop('application')),
                id=instance.pop('id', None),
                name=instance.pop('name', None),
                environment=self.get_or_create_environment(
                    name=instance.pop('environment', 'default')),
                **instance)
            assert launched.running(timeout)
예제 #23
0
    def test_workflow_removed(self):
        """ Reconfigure app removing workflow. Workflow should be destroyed after reconfiguration.
        """
        src = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "workflow-binding_added.yml"))
        dst = Manifest(
            file=os.path.join(os.path.dirname(__file__), "workflow-base.yml"))

        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        @retry(5, 2, 1)
        def waitFor():
            return not reconfigured_inst.returnValues.has_key(
                'out.app2_output')

        waitFor()

        self.assertFalse(
            reconfigured_inst.returnValues.has_key('out.app2_output'))
        self.assertEqual("Hello from BASE WORKFLOW manifest",
                         reconfigured_inst.returnValues['out.app_output'])
        self.assertFalse(
            'action.newgo' in
            [x['name'] for x in reconfigured_inst.availableWorkflows])

        self.assertTrue(
            self.inst1.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst1.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
예제 #24
0
    def test_smart_application_method(self):
        org = self.org
        app = self.app
        base_app = org.get_or_create_application(
            name='Self-smart_application_method', manifest=app.manifest)

        # Get application
        self.assertEqual(base_app,
                         org.application(name='Self-smart_application_method'))
        self.assertEqual(base_app, org.application(id=base_app.id))
        self.assertEqual(
            base_app,
            org.application(id=base_app.id,
                            name='Self-smart_application_method'))

        # Modify application
        new_name_app = org.application(
            id=base_app.id, name='Self-smart_application_method-new-name')
        self.assertEqual(base_app, new_name_app)
        self.assertEqual('Self-smart_application_method-new-name',
                         new_name_app.name)

        new_manifest = Manifest(file=os.path.join(os.path.dirname(__file__),
                                                  'default.yml'),
                                name='Updated')
        new_manifest.patch('application/configuration/in.app_input', 'NEW NEW')
        new_name_app = org.application(id=base_app.id, manifest=new_manifest)
        self.assertEqual(base_app, new_name_app)
        self.assertTrue('NEW NEW' in base_app.get_manifest()['manifest'])

        # Create application
        new_application = org.application(
            name='Self-smart_application_method-create', manifest=app.manifest)
        self.assertEqual('Self-smart_application_method-create',
                         new_application.name)
        self.assertTrue(new_application in org.applications)
        self.assertTrue(new_application.delete())

        # Clean
        self.assertTrue(base_app.delete())
예제 #25
0
    def test_marker_property_usage(self):
        mnf = Manifest(
            file=os.path.join(os.path.dirname(__file__),
                              "marker-property.yml"))  #Todo: resolve paths
        self.app.upload(mnf)
        self.env.set_backend(self.organization.zoneId)

        self.assertTrue(
            self.env.propertyAdd(name='sample-property-str',
                                 type='string',
                                 value='test-property-string'))
        self.assertTrue(
            self.env.propertyAdd(name='sample-property-int',
                                 type='int',
                                 value='42'))
        self.assertTrue(
            self.env.propertyAdd(name='sample-property-obj',
                                 type='object',
                                 value='aa:bb'))
        self.assertTrue(self.env.markerAdd('test-marker'))

        self.env.serviceAdd(self.wf_service)
        self.env.serviceAdd(self.key_service)

        ins = self.app.launch(destroyInterval=300000,
                              environmentId=self.env.environmentId)
        self.assertTrue(
            ins, "%s-%s: Instance failed to launch" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            ins.ready(),
            "%s-%s: Instance not in 'running' state after timeout" %
            (self.prefix, self._testMethodName))

        out = ins.returnValues
        self.assertEqual(out['output.str'], 'test-property-string')
        self.assertEqual(out['output.int'], '42')
        self.assertEqual(out['output.obj'], 'aa:bb')

        # TODO: instance should be destroyed before properties removed, otherwise it will be in inconsistent state and
        self.assertTrue(
            ins.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            ins.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))

        self.assertTrue(self.env.propertyRemove(name='sample-property-str'))
        self.assertTrue(self.env.propertyRemove(name='sample-property-int'))
        self.assertTrue(self.env.propertyRemove(name='sample-property-obj'))
        self.assertTrue(self.env.markerRemove('test-marker'))
예제 #26
0
    def test_workflow_update(self):
        """ Reconfigure app changing workflow. Workflow should be updated.
        """
        src = Manifest(
            file=os.path.join(os.path.dirname(__file__), "workflow-base.yml"))
        dst = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "workflow-workflow_changed.yml"))

        reconfigured_inst = self.reconf(src, dst)
        self.assertTrue(reconfigured_inst.ready())

        reconfigured_inst.runWorkflow(name='action.gogogo')
        self.assertTrue(reconfigured_inst.ready())

        @retry(5, 2, 1)
        def waitFor():
            return "NEW GOGO launched" in reconfigured_inst.returnValues[
                'out.app_output']

        waitFor()

        self.assertEqual("NEW GOGO launched",
                         reconfigured_inst.returnValues['out.app_output'])

        self.assertTrue(
            self.inst1.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst1.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.inst2.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
예제 #27
0
    def setUpClass(cls):
        super(HierappReconfiguration, cls).setUpClass()
        cls.parent_app = cls.organization.application(
            name="%s-reconfiguration-hierapp-parent" % cls.prefix,
            manifest=cls.manifest)
        cls.child_app = cls.organization.application(
            name="%s-reconfiguration-hierapp-child" % cls.prefix,
            manifest=cls.manifest)
        cls.new_child_app = cls.organization.application(
            name="%s-reconfiguration-hierapp-child-new" % cls.prefix,
            manifest=cls.manifest)

        # Prepare child
        cmnf = Manifest(
            file=os.path.join(os.path.dirname(__file__), "hier-child.one.yml"))
        cls.child_app.upload(cmnf)

        # Prepare shared child
        cls.child_instance = cls.child_app.launch(destroyInterval=3000000)
        assert cls.child_instance.ready()

        # Need to specify parameters, otherwise we'll get empty revision...
        parameters = [{
            "name": "parent_in.child_input",
            "value": "Hello from parent to child"
        }]

        cls.child_rev = cls.child_app.create_revision(
            name='tests-reconf-hierapp-shared',
            instance=cls.child_instance,
            parameters=parameters)
        cls.shared_service.add_shared_instance(cls.child_rev,
                                               cls.child_instance)

        # Prepare new_child
        cmnf = Manifest(
            file=os.path.join(os.path.dirname(__file__), "hier-child.two.yml"))
        cls.new_child_app.upload(cmnf)
    def setUp(self):
        super(InstanceStatusTest, self).setUp()
        manifest = Manifest(file=os.path.join(os.path.dirname(__file__),
                                              'propagate_status.yml'))
        self.app.upload(manifest)
        self.instance = self.app.launch(destroyInterval=300000)

        self.assertTrue(
            self.instance, "%s-%s: Instance failed to launch" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.instance.ready(),
            "%s-%s: Instance not in 'running' state after timeout" %
            (self.prefix, self._testMethodName))
    def setUpClass(cls):
        super(ThreeLevelHierappReconfiguration, cls).setUpClass()

        # Create applications for tests
        mnf = Manifest(
            file=os.path.join(os.path.dirname(__file__), "3level-child.yml"))
        cls.last_child = cls.organization.application(
            name="%s-reconfiguration-3lhierapp-last_child" % cls.prefix,
            manifest=mnf)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "3level-middle-child.yml"))
        mnf.patch(
            'application/components/last_child/configuration/__locator.application-id',
            cls.last_child.applicationId)
        cls.middle_child = cls.organization.application(
            name="%s-reconfiguration-3lhierapp-middle-child" % cls.prefix,
            manifest=mnf)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "3level-super-parent.yml"))
        mnf.patch(
            'application/components/middle_child/configuration/__locator.application-id',
            cls.middle_child.applicationId)
        cls.parent = cls.organization.application(
            name="%s-reconfiguration-3lhierapp-super-parent" % cls.prefix,
            manifest=mnf)

        # Create shared last_child
        cls.last_child_instance = cls.last_child.launch(destroyInterval=300000)
        assert cls.last_child_instance.ready()
        cls.last_child_rev = cls.last_child.create_revision(
            name='tests-reconf-3l-hierapp-shared',
            instance=cls.last_child_instance)
        cls.shared_service.add_shared_instance(cls.last_child_rev,
                                               cls.last_child_instance)
    def setUpClass(cls):
        super(ThreeLevelHierarchicalAppTest, cls).setUpClass()

    # Create applications for tests
        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "child.yml"))
        cls.last_child = cls.organization.application(name="%s-test-3lhierapp-last_child" % cls.prefix, manifest=mnf)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "middle_child.yml"))
        mnf.patch('application/components/last_child/configuration/__locator.application-id', cls.last_child.applicationId)
        cls.middle_child = cls.organization.application(name="%s-test-3lhierapp-middle-child" % cls.prefix, manifest=mnf)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "super_parent.yml"))
        mnf.patch('application/components/middle_child/configuration/__locator.application-id', cls.middle_child.applicationId)
        cls.parent = cls.organization.application(name="%s-test-3lhierapp-super-parent" % cls.prefix, manifest=mnf)
예제 #31
0
    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 test_revision(self):
        ''' Create new revision. Change latest manifest. Launch revision and check it uses not latest, but revisions manifest.
        '''
        # Not implemented via public api
        rev = self.app.create_revision(name='test-revision-launch',
                                       instance=self.instance)
        self.assertTrue(rev)

        manf1 = Manifest(file=os.path.join(os.path.dirname(__file__),
                                           'simple_manifest.yml'))
        self.app_public.upload(
            manf1
        )  # Upload new manifest. So, latest is not same as in our revision.

        inst1 = self.app_public.launch(destroyInterval=600000,
                                       revisionId=rev.revisionId)
        self.assertTrue(inst1.ready(), 'Failed to launch instance.')
        self.assertEqual('This is default manifest',
                         inst1.returnValues['out.app_output'])

        self.assertTrue(self.app.delete_instance(inst1.instanceId))
        self.assertTrue(rev.delete())
예제 #33
0
    def test_configuration_multi_mapping(self):
        manifest = Manifest(
            file=os.path.join(os.path.dirname(__file__), 'multi_mapping.yml'))
        self.app.upload(manifest)
        self.instance = self.app.launch(destroyInterval=300000)

        self.assertTrue(
            self.instance, "%s-%s: Instance failed to launch" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            self.instance.ready(),
            "%s-%s: Instance not in 'running' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertEqual('Running', self.instance.status)

        retvals = self.instance.returnValues
        self.assertEqual('Hello from BASE WORKFLOW manifest',
                         retvals['out.app_output1'])
        self.assertEqual('Hello from BASE WORKFLOW manifest',
                         retvals['out.app_output2'])
        self.assertTrue(self.instance.destroy())
        self.assertTrue(self.instance.destroyed())
    def setUpClass(cls):
        super(ThreeLevelHierappReconfiguration, cls).setUpClass()

    # Create applications for tests
        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "3level-child.yml"))
        cls.last_child = cls.organization.application(name="%s-reconfiguration-3lhierapp-last_child" % cls.prefix, manifest=mnf)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "3level-middle-child.yml"))
        mnf.patch('application/components/last_child/configuration/__locator.application-id', cls.last_child.applicationId)
        cls.middle_child = cls.organization.application(name="%s-reconfiguration-3lhierapp-middle-child" % cls.prefix, manifest=mnf)

        mnf = Manifest(file=os.path.join(os.path.dirname(__file__), "3level-super-parent.yml"))
        mnf.patch('application/components/middle_child/configuration/__locator.application-id', cls.middle_child.applicationId)
        cls.parent = cls.organization.application(name="%s-reconfiguration-3lhierapp-super-parent" % cls.prefix, manifest=mnf)


    # Create shared last_child
        cls.last_child_instance = cls.last_child.launch(destroyInterval=300000)
        assert cls.last_child_instance.ready()
        cls.last_child_rev = cls.last_child.create_revision(name='tests-reconf-3l-hierapp-shared', instance=cls.last_child_instance)
        cls.shared_service.add_shared_instance(cls.last_child_rev, cls.last_child_instance)
예제 #35
0
    def test_run_trigger_on_parameter_change(self):
        """ Reconfigure app changing input parameters. There is trigger on input parameter. Changing that parameter shous run trigger that updates output.
        """
        src = Manifest(file=os.path.join(os.path.dirname(__file__),
                                         "workflow-trigger_on_param.yml"))
        self.client.upload(src)
        inst1 = self.client.launch(destroyInterval=300000)
        self.assertTrue(
            inst1, "%s-%s: Instance failed to launch" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            inst1.ready(),
            "%s-%s: Instance not in 'running' state after timeout" %
            (self.prefix, self._testMethodName))
        self.assertEqual("Hello from BASE WORKFLOW manifest",
                         inst1.returnValues['out.app_output'])

        new_params = {'in.app_trigger': 'trig it'}
        inst1.reconfigure(parameters=new_params)
        self.assertTrue(inst1.ready(),
                        "Instance failed to finish reconfiguration")

        @retry(5, 2, 1)
        def waitFor():
            return "UPDATED by update workflow" in inst1.returnValues[
                'out.app_output']

        waitFor()
        self.assertEqual("UPDATED by update workflow",
                         inst1.returnValues['out.app_output'])

        self.assertTrue(
            inst1.delete(), "%s-%s: Instance failed to destroy" %
            (self.prefix, self._testMethodName))
        self.assertTrue(
            inst1.destroyed(),
            "%s-%s: Instance not in 'destroyed' state after timeout" %
            (self.prefix, self._testMethodName))
예제 #36
0
class BaseTestCase(SetupOnce, unittest.TestCase):
    parameters=parameters
    ## TODO: Main preparation should be here
    """ Here we prepare global env. (load config, etc)
    """
    # Set default manifest for app creation
    manifest = Manifest(file=os.path.join(os.path.dirname(__file__), './default.yml'), name='BaseTestManifest')
    platform = QubellPlatform.connect(user=parameters['user'], password=parameters['pass'], tenant=parameters['tenant'], token=parameters['token'])


    def setup_once(self):
        def type_to_app(t):
            return self.organization.applications[system_application_types.get(t, t)]
    # Initialize organization
        if os.getenv("QUBELL_IT_LOCAL"):
            self.parameters['organization'] = self.__class__.__name__
        self.organization = self.platform.organization(name=self.parameters['organization'])

        if zone:
            z = [x for x in self.organization.list_zones() if x['name'] == zone]
            if z:
                self.organization.zoneId = z[0]['id']


    # Initialize environment
        if zone:
            self.environment = self.organization.environment(name='default', zone=self.organization.zoneId)
            self.environment.set_backend(self.organization.zoneId)
        else:
            self.environment = self.organization.get_environment(name='default')

        self.shared_service = self.organization.service(name='BaseTestSharedService',
                                                        application=type_to_app(SHARED_INSTANCE_CATALOG_TYPE),
                                                        environment=self.environment,
                                                        parameters={'configuration.shared-instances': {}})
        self.wf_service, self.key_service, self.cloud_account_service = self.environment.init_common_services()
예제 #37
0
    def test_launch_hierapp_with_combined_child_instances(self):
        """ Launch hierarchical app with two shared and one non shared instance.
        """

        pmnf = Manifest(file=os.path.join(os.path.dirname(__file__), "parent_childs.yml")) #Todo: resolve paths
        pmnf.patch('application/components/child-one/configuration/__locator.application-id', self.child_one.applicationId)
        pmnf.patch('application/components/child-two/configuration/__locator.application-id', self.child_two.applicationId)
        pmnf.patch('application/components/child-three/configuration/__locator.application-id', self.child_three.applicationId)

        # TODO: bug. Need to pass params
        parameters = {
                "parent_in.child_three_input": "Hello from parent to child3 BUG"}
        submodules = {
                "child-one": {
                    "revisionId": self.child_one_revision.revisionId},
                "child-two": {
                    "revisionId": self.child_two_revision.revisionId}}


        self.parent.upload(pmnf)
        parent_instance = self.parent.launch(destroyInterval=600000, parameters=parameters, submodules=submodules)
        self.assertTrue(parent_instance, "%s-%s: Instance failed to launch" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.ready(),"%s-%s: Instance not in 'running' state after timeout" % (self.prefix, self._testMethodName))

        self.assertEqual(parent_instance.submodules[0]['status'], 'Running')
        sub = parent_instance.submodules

        self.assertTrue(len([sid for sid in sub if sid['id'] == self.child_one_instance.instanceId]))  # Way i search for id
        self.assertTrue(len([sid for sid in sub if sid['id'] == self.child_two_instance.instanceId]))
        self.assertFalse(len([sid for sid in sub if sid['id'] == self.child_three_instance.instanceId]))


        # Shouldn't be able to remove child while parent use it and should return error
        # TODO: BUG
        #self.assertFalse(child_instance.destroy())

        self.assertTrue(parent_instance.delete(), "%s-%s: Instance failed to destroy" % (self.prefix, self._testMethodName))
        self.assertTrue(parent_instance.destroyed(), "%s-%s: Instance not in 'destroyed' state after timeout" % (self.prefix, self._testMethodName))
      "usedEnvironments": [],
      "ec2SecurityGroup": "default",
      "providerCopy": "aws-ec2",
      "name": "test-provider",
      "jcloudsIdentity": KEY,
      "jcloudsCredential": SECRET_KEY,
      "jcloudsRegions": "us-east-1"
    }
    prov = org.provider(access)
    env.add_provider(prov)
    return org.organizationId


# Define manifest. We take example from documentation.
# TODO: make manifests accessible from docs.qubell.com
app_manifest = Manifest(url="https://raw.github.com/qubell/contrib-python-qubell-client/master/qm/hierarchical-main.yml")
db_manifest = Manifest(url="https://raw.github.com/qubell/contrib-python-qubell-client/master/qm/hierarchical-db.yml")


# Initialize our qubell platform
platform = QubellPlatform(context=context)

# Try to login
assert platform.authenticate()
print "Authenticate passed"

# Create new organization
org = platform.organization(name="python-qubellclient")

# Use existing organization
# org = platform.organization(id="524f3028e4b0b12cd4de2759")
예제 #39
0
__version__ = "1.0.10"
__email__ = "*****@*****.**"


from stories import base
from stories.base import attr
from qubell.api.private.manifest import Manifest
from qubell.api.private.organization import Organization


mnf = Manifest(content="""
application:
  components:
    empty:
      type: cobalt.common.Constants
      interfaces:
        int1:
          pin1: publish-signal(string)
      configuration:
        configuration.values:
          int1.pin1: "HIHIHI"
""")

class InstanceTest(base.BaseTestCasePrivate):

    @classmethod
    def setUpClass(cls):
        super(InstanceTest, cls).setUpClass()
        cls.org = cls.organization


    def setUp(self):