diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-02-03 15:01:34 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-02-03 15:01:34 +0100 |
commit | 5ee1e950f1e2be10762f5f08fe82bb7bd3a68bb4 (patch) | |
tree | ec7095c8cd6ae287f133f0c3e3582e937eb6ade8 /ansible/roles/rke/molecule/default/tests/test_infrastructure.py | |
parent | 31d3a265b3f7613f1af536c4a04f119ea83d9794 (diff) |
Change 'rke' role testing strategy
So far Molecule framework setup allowed full rke cluster deployment
in testing env but since rke cluster often fails to deploy in resource
constrained CI environment this change switches testing strategy to
only simulate 'rke up' operation.
Change-Id: Ia221da6666d558e086cd24155f5bd81237d82388
Issue-ID: OOM-2665
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'ansible/roles/rke/molecule/default/tests/test_infrastructure.py')
-rw-r--r-- | ansible/roles/rke/molecule/default/tests/test_infrastructure.py | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/ansible/roles/rke/molecule/default/tests/test_infrastructure.py b/ansible/roles/rke/molecule/default/tests/test_infrastructure.py index 731f38bf..81f90d17 100644 --- a/ansible/roles/rke/molecule/default/tests/test_infrastructure.py +++ b/ansible/roles/rke/molecule/default/tests/test_infrastructure.py @@ -1,6 +1,5 @@ import os import pytest -import json import testinfra.utils.ansible_runner @@ -11,7 +10,9 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( @pytest.mark.parametrize('filename', [ '/root/.kube/config', '/opt/onap/cluster/cluster.yml', - '/opt/onap/cluster/cluster.rkestate']) + '/opt/onap/cluster/kubernetes-dashboard.yml', + '/opt/onap/cluster/k8s-dashboard-user.yml', + '/opt/onap/cluster/kube_config_cluster.yml']) def test_file_existence(host, filename): assert host.file(filename).exists @@ -22,35 +23,4 @@ def test_rke_in_path(host): def test_rke_version_works(host): # Note that we need to cd to the cluster data dir first, really. - assert host.run('cd /opt/onap/cluster && rke version').rc == 0 - - -def test_nodes_ready(host): - # Retrieve all node names. - nodecmdres = host.run('kubectl get nodes -o name') - assert nodecmdres.rc == 0 - nodes = nodecmdres.stdout.split('\n') - for node in nodes: - assert host.run( - 'kubectl wait --timeout=0 --for=condition=ready ' + node).rc == 0 - - -def test_pods_ready(host): - # Retrieve all pods from all namespaces. - # Because we need pod and namespace name, we get full json representation. - podcmdres = host.run('kubectl get pods --all-namespaces -o json') - assert podcmdres.rc == 0 - pods = json.loads(podcmdres.stdout)['items'] - for pod in pods: - # Each pod may be either created by a job or not. - # In job case they should already be completed - # when we are here so we ignore them. - namespace = pod['metadata']['namespace'] - podname = pod['metadata']['name'] - condition = 'Ready' - if len(pod['metadata']['ownerReferences']) == 1 and pod[ - 'metadata']['ownerReferences'][0]['kind'] == 'Job': - continue - assert host.run( - 'kubectl wait --timeout=240s --for=condition=' + condition + ' -n ' + - namespace + ' pods/' + podname).rc == 0 + assert host.run('cd /opt/onap/cluster && rke').rc == 0 |