summaryrefslogtreecommitdiffstats
path: root/ansible/roles/rke/molecule/default/tests/test_infrastructure.py
blob: 81f90d175199baefecaf6cd6f364207a4417a664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import pytest

import testinfra.utils.ansible_runner

testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('infrastructure')


@pytest.mark.parametrize('filename', [
  '/root/.kube/config',
  '/opt/onap/cluster/cluster.yml',
  '/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


def test_rke_in_path(host):
    assert host.find_command('rke') == '/usr/local/bin/rke'


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').rc == 0