123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- import pytest
- import rostest.util as u
- from rostest.util import SSH
- cloud_config_path = './tests/integration/assets/test_14/cloud-config.yml'
- @pytest.fixture(scope="module")
- def qemu(request):
- q = u.run_qemu(request, run_args=['--cloud-config', cloud_config_path])
- u.flush_out(q.stdout)
- return q
- def test_ros_config_string(qemu):
- SSH(qemu).check_call('''
- set -x -e
- if [ "$(sudo ros config get hostname)" == "hostname3
- " ]; then
- sudo ros config get hostname
- exit 1
- fi
- sudo ros config set hostname rancher-test
- if [ "$(sudo ros config get hostname)" == "rancher-test
- " ]; then
- sudo ros config get hostname
- exit 1
- fi
- '''.strip())
- def test_ros_config_bool(qemu):
- SSH(qemu).check_call('''
- set -x -e
- if [ "$(sudo ros config get rancher.log)" == "true
- " ]; then
- sudo ros config get rancher.log
- exit 1
- fi
- sudo ros config set rancher.log false
- if [ "$(sudo ros config get rancher.log)" == "false
- " ]; then
- sudo ros config get rancher.log
- exit 1
- fi
- if [ "$(sudo ros config get rancher.debug)" == "false
- " ]; then
- sudo ros config get rancher.debug
- exit 1
- fi
- sudo ros config set rancher.debug true
- if [ "$(sudo ros config get rancher.debug)" == "true
- " ]; then
- sudo ros config get rancher.debug
- exit 1
- fi
- '''.strip())
- def test_ros_config_slice(qemu):
- SSH(qemu).check_call('''
- set -x -e
- sudo ros config set rancher.network.dns.search '[a,b]'
- if [ "$(sudo ros config get rancher.network.dns.search)" == "- a
- - b
- " ]; then
- sudo ros config get rancher.network.dns.search
- exit 1
- fi
- sudo ros config set rancher.network.dns.search '[]'
- if [ "$(sudo ros config get rancher.network.dns.search)" == "[]
- " ]; then
- sudo ros config get rancher.network.dns.search
- exit 1
- fi
- '''.strip())
- def test_ros_export(qemu):
- SSH(qemu).check_call('''
- set -x -e
- if sudo ros config export | grep "PRIVATE KEY"; then
- exit 1
- fi
- sudo ros config export --private | grep "PRIVATE KEY"
- sudo ros config export --full | grep "udev"
- sudo ros config export --private --full | grep "ntp"
- sudo ros config export --full | grep "labels"
- sudo ros config export --private --full | grep "PRIVATE KEY"
- '''.strip())
|