Add virtlet confirmance test run
Change-Id: I673e064cacfee8e7651443aa52b9a6bc8ad28670
diff --git a/tcp_tests/managers/k8smanager.py b/tcp_tests/managers/k8smanager.py
index 6394141..1126011 100644
--- a/tcp_tests/managers/k8smanager.py
+++ b/tcp_tests/managers/k8smanager.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import os
import time
from uuid import uuid4
@@ -496,3 +497,44 @@
"tail -n +3 | awk {{'print $2'}}".format(domain_id))
result = self.__underlay.check_call(cmd, node_name=self.ctl_host)
return result['stdout'].strip()
+
+ def run_virtlet_conformance(self, timeout=60 * 60,
+ log_file='virtlet_conformance.log'):
+ if self.__config.k8s.run_extended_virtlet_conformance:
+ ci_image = "cloud-images.ubuntu.com/xenial/current/" \
+ "xenial-server-cloudimg-amd64-disk1.img"
+ cmd = ("set -o pipefail; "
+ "docker run --net=host {0} /virtlet-e2e-tests "
+ "-include-cloud-init-tests -image {2} "
+ "-sshuser ubuntu -memoryLimit 1024 "
+ "-alsologtostderr -cluster-url http://127.0.0.1:8080 "
+ "-ginkgo.focus '\[Conformance\]' "
+ "| tee {1}".format(
+ self.__config.k8s_deploy.kubernetes_virtlet_image,
+ log_file, ci_image))
+ else:
+ cmd = ("set -o pipefail; "
+ "docker run --net=host {0} /virtlet-e2e-tests "
+ "-alsologtostderr -cluster-url http://127.0.0.1:8080 "
+ "-ginkgo.focus '\[Conformance\]' "
+ "| tee {1}".format(
+ self.__config.k8s_deploy.kubernetes_virtlet_image,
+ log_file))
+ LOG.info("Executing: {}".format(cmd))
+ with self.__underlay.remote(
+ node_name=self.ctl_host) as remote:
+ result = remote.check_call(cmd, timeout=timeout)
+ stderr = result['stderr']
+ stdout = result['stdout']
+ LOG.info("Test results stdout: {}".format(stdout))
+ LOG.info("Test results stderr: {}".format(stderr))
+ return result
+
+ def download_virtlet_conformance_log(self,
+ log_file='virtlet_conformance.log'):
+ master_host = self.__config.salt.salt_master_host
+ with self.__underlay.remote(host=master_host) as r:
+ cmd = "rsync {0}:/root/{1} /root/".format(self.ctl_host, log_file)
+ r.check_call(cmd, raise_on_err=False)
+ LOG.info("Downloading the artifact {0}".format(log_file))
+ r.download(destination=log_file, target=os.getcwd())