From: Naga Sugguna Date: Thu, 31 Oct 2019 20:56:12 +0000 (+0000) Subject: Convention over configuration X-Git-Tag: 3.0.0~27^2 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F91%2F1891%2F9;p=validation.git Convention over configuration Jira: [VAL-83] bluva.py is taking varibles.yaml and writing updated version to varibles_updated.yaml varibles_updated.yaml is passed to robot framework. OperatingSystem.Get Environment is better than $HOME. Each container automatically removed Each test suite has a debug.log by default Signed-off-by: Naga Sugguna Change-Id: Iae95d1ee12c8c5e44949be3faf5b0fc9fc40266e --- diff --git a/bluval/blucon.py b/bluval/blucon.py index 7fc8002..cea16de 100644 --- a/bluval/blucon.py +++ b/bluval/blucon.py @@ -57,7 +57,7 @@ def invoke_docker(bluprint, layer): """Start docker container for given layer """ volume_list = get_volumes('common') + get_volumes(layer) - cmd = ("docker run" + volume_list + _SUBNET + + cmd = ("docker run --rm" + volume_list + _SUBNET + " akraino/validation:{0}-latest" " /bin/sh -c" " 'cd /opt/akraino/validation " diff --git a/bluval/bluval.py b/bluval/bluval.py index feefa5e..c79c830 100644 --- a/bluval/bluval.py +++ b/bluval/bluval.py @@ -59,11 +59,12 @@ def run_testcase(testcase): variables_file = mypath.parents[1].joinpath("tests/variables.yaml") variables_dict = yaml.safe_load(variables_file.open()) variables_dict['log_path'] = str(results_path) - variables_file.write_text(str(variables_dict)) + variables_updated_file = mypath.parents[1].joinpath("tests/variables_updated.yaml") + variables_updated_file.write_text(str(variables_dict)) # run the test - args = ["robot", "-V", str(variables_file), "-d", - str(results_path), str(test_path)] + args = ["robot", "-V", str(variables_updated_file), "-d", str(results_path), + "-b", "debug.log", str(test_path)] print('Executing testcase {}'.format(name)) print('show_stopper {}'.format(show_stopper)) diff --git a/bluval/volumes.yaml b/bluval/volumes.yaml index 0e062ea..da0a839 100644 --- a/bluval/volumes.yaml +++ b/bluval/volumes.yaml @@ -23,7 +23,7 @@ volumes: # location of the ssh key to access the cluster - ssh_key_file: + ssh_key_dir: local: '' target: '/root/.ssh' # location of the k8s access files (config file, certificates, keys) @@ -51,16 +51,18 @@ layers: - blueprint_dir - results_dir hardware: - - ssh_key_file + - ssh_key_dir os: - - ssh_key_file + - ssh_key_dir networking: - - ssh_key_file + - ssh_key_dir + docker: + - ssh_key_dir k8s: - - ssh_key_file + - ssh_key_dir - kube_config_dir k8s_networking: - - ssh_key_File + - ssh_key_dir - kube_config_dir sds: sdn: diff --git a/tests/k8s/etcd_ha/etcd_ha.resource b/tests/k8s/etcd_ha/etcd_ha.resource index 1486b9e..c3b7e42 100644 --- a/tests/k8s/etcd_ha/etcd_ha.resource +++ b/tests/k8s/etcd_ha/etcd_ha.resource @@ -25,7 +25,7 @@ Library OperatingSystem *** Variables *** ${ETCD_VERSION} 3 -${SSH_KEYFILE} ${HOME}/.ssh/id_rsa +${SSH_KEYFILE} /root/.ssh/id_rsa *** Keywords *** Open Connection And Log In diff --git a/tests/os/cyclictest/cyclictest.robot b/tests/os/cyclictest/cyclictest.robot index f7b6709..d272c77 100644 --- a/tests/os/cyclictest/cyclictest.robot +++ b/tests/os/cyclictest/cyclictest.robot @@ -26,9 +26,7 @@ Suite Teardown Close All Connections *** Variables *** ${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log -#${USERNAME} mm747b -#${HOME} /home/${USERNAME} -#${HOST} aknode109 +${SSH_KEYFILE} /root/.ssh/id_rsa *** Test Cases *** @@ -41,5 +39,5 @@ Latency Test *** Keywords *** Open Connection And Log In Open Connection ${HOST} - Login With Public Key ${USERNAME} ${HOME}/.ssh/id_rsa + Login With Public Key ${USERNAME} ${SSH_KEYFILE} diff --git a/tests/variables.yaml b/tests/variables.yaml index 1da77ef..4a68a51 100644 --- a/tests/variables.yaml +++ b/tests/variables.yaml @@ -17,17 +17,25 @@ # This file provides variables required by robot testcases # This file can be passed to robot testcases as follows -# $ robot -v varables.yaml +# $ robot -V variables.yaml # # All keys are converted UPPERCASE before submitting to robot. YAML notation is # smallcase and Robot variables notation is UPPERCASE so industry is following # this. +# +# bluval.py takes this file and updates it to new file and passes to +# robot framework +# + ### Input variables cluster's master host -host: aknode109 # cluster's master host address -username: mm747b # user credentials -home: /home/mm747b # Public keys location -ssh_keyfile: ~/.ssh/id_rsa # Identity file for authentication +host: 172.28.17.206 # cluster's master host address +username: cloudadmin # login name to connect to cluster +ssh_keyfile: /root/.ssh/id_rsa # Identity file for authentication + +### bluval.py adds/modifies following, before passing to robot. +### while debugging from CLI user has to modify these +# log_path: /opt/akraino/results// ### Input variables for bios_version_dell.robot sysinfo: PowerEdge R740xd