def extraSetUp(self, kot, kog): self.kw = TestData.setup_kwargs(kog) self.setup_kot = object_setUp(KubeOaatType, kot) self.setup = object_setUp(KubeOaatGroup, kog) next(self.setup_kot) next(self.setup) ogo = OaatGroupOverseer(**self.kw) self.assertIsInstance(ogo, OaatGroupOverseer) self.assertIsInstance(ogo.oaattype, OaatType) return ogo
def test_validate_type(self): kog = TestData.kog kw = TestData.setup_kwargs(kog) setup_kot = object_setUp(KubeOaatType, TestData.kot) setup = object_setUp(KubeOaatGroup, kog) next(setup_kot) next(setup) ogo = OaatGroupOverseer(**kw) ogo.validate_oaat_type() next(setup) # delete KubeOaatGroup next(setup_kot) # delete KubeOaatType
def test_create_none(self): kog = TestData.kog kw = TestData.setup_kwargs(kog) setup_kot = object_setUp(KubeOaatType, TestData.kot) setup = object_setUp(KubeOaatGroup, kog) next(setup_kot) next(setup) ogo = OaatGroupOverseer(**kw) self.assertIsInstance(ogo, OaatGroupOverseer) self.assertEqual(ogo.freq, datetime.timedelta(seconds=60)) self.assertIsInstance(ogo.oaattype, OaatType) next(setup) # delete KubeOaatGroup next(setup_kot) # delete KubeOaatType
def test_podspec_emptyspec(self): kog = TestData.kog_emptyspec kw = TestData.setup_kwargs(kog) setup_kot = object_setUp(KubeOaatType, TestData.kot) setup = object_setUp(KubeOaatGroup, kog) next(setup_kot) next(setup) og = OaatGroupOverseer(**kw) with self.assertRaises(ProcessingComplete) as exc: og.validate_oaat_type() self.assertEqual(exc.exception.ret['error'], 'unknown oaat type None') next(setup) next(setup_kot)
def test_podspec(self): setup = object_setUp(KubeOaatType, BasicTests.kot) next(setup) ot = OaatType('test-kot') podspec = ot.podspec() self.assertEqual(podspec['container']['name'], 'test') next(setup)
def test_create(self): kp = TestData.kp kw = TestData.setup_kwargs(kp) setup_kp = object_setUp(Pod, TestData.kp) next(setup_kp) op = PodOverseer(object, **kw) self.assertIsInstance(op, PodOverseer) next(setup_kp) # delete Pod
def test_podspec_without_type(self): setup = object_setUp(KubeOaatType, BasicTests.kot_notype) next(setup) ot = OaatType('test-kot') with self.assertRaises(ProcessingComplete) as exc: ot.podspec() self.assertEqual(exc.exception.ret['error'], 'spec.type must be "pod"') next(setup)
def test_podspec_nonepodspec(self): setup = object_setUp(KubeOaatType, BasicTests.kot_nonepodspec) next(setup) ot = OaatType('test-kot') with self.assertRaises(ProcessingComplete) as exc: ot.podspec() self.assertEqual(exc.exception.ret['error'], 'spec.podspec is missing') next(setup)
def test_podspec_restartPolicy(self): setup = object_setUp(KubeOaatType, BasicTests.kot_restartPolicy) next(setup) ot = OaatType('test-kot') with self.assertRaises(ProcessingComplete) as exc: ot.podspec() self.assertRegex(exc.exception.ret['error'], '.*you cannot specify a restartPolicy') next(setup)
def test_podspec_containers(self): setup = object_setUp(KubeOaatType, BasicTests.kot_containers) next(setup) ot = OaatType('test-kot') with self.assertRaises(ProcessingComplete) as exc: ot.podspec() self.assertRegex(exc.exception.ret['error'], 'currently only support a single container.*') next(setup)