예제 #1
0
    def test_sessionStates_noDrops(self):
        # No drops created, we can deploy right away
        with Session('1') as s:
            self.assertEqual(SessionStates.PRISTINE, s.status)
            s.deploy()
            self.assertEqual(SessionStates.FINISHED, s.status)

        with Session('2') as s:
            self.assertRaises(InvalidGraphException,
                              s.deploy,
                              completedDrops=['a'])
예제 #2
0
 def createSession(self, sessionId):
     if sessionId in self._sessions:
         raise SessionAlreadyExistsException(sessionId)
     self._sessions[sessionId] = Session(sessionId, self._host,
                                         self._error_listener,
                                         self._enable_luigi)
     logger.info('Created session %s', sessionId)
예제 #3
0
    def test_linking(self):
        with Session('1') as s:
            s.addGraphSpec([{"oid": "A", "type": "container"}])
            s.addGraphSpec([{
                "oid": "B",
                "type": "app",
                "storage": "null",
                "app": "dfms.apps.crc.CRCApp"
            }])
            s.addGraphSpec([{"oid": "C", "type": "container"}])

            # Link them now
            s.linkGraphParts('A', 'B', DROPLinkType.CONSUMER)
            s.linkGraphParts('B', 'C', DROPLinkType.OUTPUT)

            # Deploy and check that the actual DROPs are linked together
            s.deploy()
            roots = s.roots
            self.assertEqual(1, len(roots))
            a = s.roots[0]
            self.assertEqual('A', a.oid)
            self.assertEqual(1, len(a.consumers))
            b = a.consumers[0]
            self.assertEqual('B', b.oid)
            self.assertEqual(1, len(b.outputs))
            c = b.outputs[0]
            self.assertEqual('C', c.oid)
예제 #4
0
    def test_addGraphSpec(self):
        with Session('1') as s:
            s.addGraphSpec([{"oid": "A", "type": "container"}])
            s.addGraphSpec([{"oid": "B", "type": "container"}])
            s.addGraphSpec([{"oid": "C", "type": "container"}])

            # Adding an existing DROP
            self.assertRaises(Exception, s.addGraphSpec, [{
                "oid": "A",
                "type": "container"
            }])

            # Adding invalid specs
            self.assertRaises(Exception, s.addGraphSpec, [{
                "oid": "D",
                "type": "app"
            }])  # missing "storage"
            self.assertRaises(Exception, s.addGraphSpec, [{
                "oid": "D",
                "type": "plain",
                "storage": "invalid"
            }])  # invalid "storage"
            self.assertRaises(Exception, s.addGraphSpec, [{
                "oid": "D",
                "type": "invalid"
            }])  # invalid "type"
            self.assertRaises(Exception, s.addGraphSpec, [{
                "oid": "D",
                "type": "app",
                "storage": "null",
                "outputs": ["X"]
            }])  # missing X DROP
예제 #5
0
    def test_sessionStates(self):
        with Session('1') as s:
            self.assertEqual(SessionStates.PRISTINE, s.status)
            self.assertRaises(Exception, s.linkGraphParts, '', '', 0)

            s.addGraphSpec([{"oid": "A", "type": "container"}])
            self.assertEqual(SessionStates.BUILDING, s.status)

            s.deploy()
            self.assertEqual(SessionStates.RUNNING, s.status)

            # Now we can't do any of these
            self.assertRaises(Exception, s.deploy)
            self.assertRaises(Exception, s.addGraphSpec, '')
            self.assertRaises(Exception, s.linkGraphParts, '', '', 0)