def test_cluster_info(self): '''Test that kubectl is installed and the cluster appears healthy.''' for master in self.masters: cluster_info = kubectl('cluster-info') output, rc = run(master, cluster_info) self.assertTrue(rc == 0) self.assertTrue('Kubernetes master' in output)
def test_kube_pods(self): '''Test that the kube-system listing contains the kube-dns pod.''' # $ kubectl get pods --namespace=kube-system # NAME READY STATUS RESTARTS AGE # noqa # kube-dns-v19-0gpcl 3/3 Running 0 7m # noqa # kubernetes-dashboard-1655269645-gpfdf 1/1 Running 0 7m # noqa if len(self.masters) > 0: unit = self.masters[0] get_pods = kubectl('get pods', namespace='kube-system') output, rc = run(unit, get_pods) self.assertTrue(rc == 0)
def test_labels(self): '''Test labels can be set.''' nodes_describe_cmd = kubectl('describe no') new_label = str(uuid.uuid4()) self.deployment.configure('kubernetes-worker', { 'labels': 'mylabel={}'.format(new_label), }) self.deployment.sentry.wait() output, rc = run(self.masters[0], nodes_describe_cmd) print("Output {}".format(output)) self.assertTrue(rc == 0) self.assertTrue(new_label in output)