Unverified Commit 1f90fb95 authored by Konstantinos Tsakalozos's avatar Konstantinos Tsakalozos Committed by GitHub
Browse files

Reorg of tests to handle timeouts (#315)

* Reorg of tests, disable prometheus, no dns disable
parent 08f174b3
......@@ -3,5 +3,5 @@
export $(grep -v '^#' /etc/environment | xargs)
apt-get update
apt-get install python-pip -y
pip install -U pytest requests pyyaml
apt-get install python3-pip -y
pip3 install -U pytest requests pyyaml
......@@ -3,5 +3,5 @@
export $(grep -v '^#' /etc/environment | xargs)
apt-get update
apt-get install python-pip -y
pip install -U pytest requests pyyaml
apt-get install python3-pip -y
pip3 install -U pytest requests pyyaml
......@@ -36,6 +36,12 @@ class TestAddons(object):
print("Enabling DNS")
microk8s_enable("dns")
wait_for_pod_state("", "kube-system", "running", label="k8s-app=kube-dns")
print("Enabling ingress")
microk8s_enable("ingress")
print("Validating ingress")
validate_ingress()
print("Disabling ingress")
microk8s_disable("ingress")
print("Enabling dashboard")
microk8s_enable("dashboard")
print("Validating dashboard")
......@@ -44,26 +50,24 @@ class TestAddons(object):
microk8s_enable("storage")
print("Validating storage")
validate_storage()
print("Disabling storage")
p = Popen("/snap/bin/microk8s.disable storage".split(), stdout=PIPE, stdin=PIPE, stderr=STDOUT)
p.communicate(input=b'Y\n')[0]
microk8s_enable("registry")
print("Validating registry")
validate_registry()
print("Enabling ingress")
microk8s_enable("ingress")
print("Validating ingress")
validate_ingress()
print("Disabling ingress")
microk8s_disable("ingress")
print("Validating Port Forward")
validate_forward()
print("Disabling registry")
microk8s_disable("registry")
print("Disabling storage")
p = Popen("/snap/bin/microk8s.disable storage".split(), stdout=PIPE, stdin=PIPE, stderr=STDOUT)
p.communicate(input=b'Y\n')[0]
print("Disabling dashboard")
microk8s_disable("dashboard")
'''
We would disable DNS here but this freezes any terminating pods.
We let microk8s.reset to do the cleanup.
print("Disabling DNS")
microk8s_disable("dns")
'''
def test_gpu(self):
"""
......@@ -74,21 +78,15 @@ class TestAddons(object):
print("GPU tests are only relevant in x86 architectures")
return
print("Enabling dns")
microk8s_enable("dns")
try:
print("Enabling gpu")
gpu_enable_outcome = microk8s_enable("gpu")
except CalledProcessError:
# Failed to enable gpu. Skip the test.
print("Disabling DNS")
microk8s_disable("dns")
return
validate_gpu()
print("Disable gpu")
microk8s_disable("gpu")
print("Disabling DNS")
microk8s_disable("dns")
def test_istio(self):
"""
......@@ -106,8 +104,6 @@ class TestAddons(object):
validate_istio()
print("Disabling Istio")
microk8s_disable("istio")
print("Disabling DNS")
microk8s_disable("dns")
def test_metrics_server(self):
"""
......@@ -130,22 +126,22 @@ class TestAddons(object):
print("Fluentd, prometheus, jaeger tests are only relevant in x86 architectures")
return
# Prometheus operator on our lxc is chashlooping disabling the test for now.
#print("Enabling prometheus")
#microk8s_enable("prometheus")
#print("Validating Prometheus")
#validate_prometheus()
#print("Disabling prometheus")
#microk8s_disable("prometheus")
print("Enabling fluentd")
microk8s_enable("fluentd")
print("Enabling prometheus")
microk8s_enable("prometheus")
print("Validating the Fluentd")
validate_fluentd()
print("Disabling fluentd")
microk8s_disable("fluentd")
print("Enabling jaeger")
microk8s_enable("jaeger")
print("Validating the Jaeger operator")
validate_jaeger()
print("Validating Prometheus")
validate_prometheus()
print("Validating the Fluentd")
validate_fluentd()
print("Disabling jaeger")
microk8s_disable("jaeger")
print("Disabling fluentd")
microk8s_disable("fluentd")
print("Disabling prometheus")
microk8s_disable("prometheus")
......@@ -111,6 +111,8 @@ class TestUpgrade(object):
# AMD64 only tests
if platform.machine() == 'x86_64':
'''
Prometheus operator on our lxc is chashlooping disabling the test for now.
try:
enable = microk8s_enable("prometheus", timeout_insec=30)
assert "Nothing to do for" not in enable
......@@ -118,6 +120,7 @@ class TestUpgrade(object):
test_matrix['prometheus'] = validate_prometheus
except:
print('Will not test the prometheus')
'''
try:
enable = microk8s_enable("fluentd", timeout_insec=30)
......
......@@ -89,7 +89,7 @@ def wait_for_pod_state(pod, namespace, desired_state, desired_reason=None, label
cmd = 'po {} -n {}'.format(pod, namespace)
if label:
cmd += ' -l {}'.format(label)
data = kubectl_get(cmd, 300)
data = kubectl_get(cmd, timeout_insec)
if pod == "":
if len(data['items']) > 0:
status = data['items'][0]['status']
......
......@@ -228,8 +228,8 @@ def validate_prometheus():
print("Prometheus tests are only relevant in x86 architectures")
return
wait_for_pod_state("prometheus-k8s-0", "monitoring", "running")
wait_for_pod_state("alertmanager-main-0", "monitoring", "running")
wait_for_pod_state("prometheus-k8s-0", "monitoring", "running", timeout_insec=1200)
wait_for_pod_state("alertmanager-main-0", "monitoring", "running", timeout_insec=1200)
def validate_fluentd():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment