def test_api_create(self): ds = DaemonSet(_constants.fluentd_daemonset()) k8s_ds = _utils.create_daemonset(name=ds.name) k8s_ds.model = ds if _utils.is_reachable(k8s_ds.config): k8s_ds.create() self.assertIsInstance(k8s_ds, K8sDaemonSet)
def test_list(self): ds = DaemonSet(_constants.fluentd_daemonset()) k8s_ds = _utils.create_daemonset(name=ds.name) k8s_ds.model = ds if _utils.is_reachable(k8s_ds.config): k8s_ds.create() _list = k8s_ds.list() for x in _list: self.assertIsInstance(x, K8sDaemonSet)
def list(self, pattern=None, labels=None): ls = super(K8sDaemonSet, self).list(labels=labels) daemons = list(map(lambda x: DaemonSet(x), ls)) if pattern is not None: daemons = list(filter(lambda x: pattern in x.name, daemons)) k8s = [] for x in daemons: j = K8sDaemonSet(config=self.config, name=x.name).from_model(m=x) k8s.append(j) return k8s
def test_cassandra_setup(self): svc = Service(utils.cassandra_service()) k8s_service = utils.create_service(name="cassandra") k8s_service.model = svc rc = ReplicationController(utils.cassandra_rc()) k8s_rc = utils.create_rc(name="cassandra") k8s_rc.model = rc ds = DaemonSet(utils.cassandra_daemonset()) k8s_ds = utils.create_daemonset(name="cassandra") k8s_ds.model = ds if utils.is_reachable(k8s_rc.config.api_host): k8s_service.create() k8s_rc.create() self.assertIsInstance(k8s_service, K8sService) self.assertIsInstance(k8s_rc, K8sReplicationController)
def get(self): self.model = DaemonSet(self.get_model()) return self