Run sonobuoy on tests
Change-Id: I75cef50d022b3145719bb4271969297b5fd1beba
This commit is contained in:
parent
2fe075ae78
commit
f0e3c43713
|
@ -14,9 +14,9 @@ import logging
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from pathlib import Path
|
||||
from tempest import config
|
||||
from tempest import test
|
||||
|
||||
import magnum_tempest_plugin
|
||||
|
||||
|
||||
|
@ -121,3 +121,35 @@ class BaseMagnumTest(test.BaseTestCase):
|
|||
except Exception as e:
|
||||
cls.LOG.exception(e)
|
||||
raise
|
||||
|
||||
@classmethod
|
||||
def run_sonobuoy(cls):
|
||||
"""Run sonobuoy
|
||||
|
||||
This method will run sonobuoy tests,
|
||||
expects a kube.config file under /tmp/magnum-nodes/
|
||||
"""
|
||||
try:
|
||||
cls.LOG.debug("running sonobuoy")
|
||||
output = subprocess.check_call(["/opt/stack/bin/sonobuoy",
|
||||
"run",
|
||||
"--mode",
|
||||
"quick",
|
||||
"--wait",
|
||||
"--kubeconfig",
|
||||
"/tmp/magnum-nodes/kube.conf"])
|
||||
except Exception as e:
|
||||
cls.LOG.exception(e)
|
||||
cls.LOG.debug("Sonobuoy output: %s\n", output)
|
||||
raise
|
||||
|
||||
try:
|
||||
cls.LOG.debug("retrieving sonobuoy logs")
|
||||
Path("/tmp/magnum-nodes/sonobuoy").mkdir(parents=True, exist_ok=True)
|
||||
retrieve = subprocess.check_call(["/opt/stack/bin/sonobuoy",
|
||||
"retrieve",
|
||||
"--extract",
|
||||
"--retrieve-path",
|
||||
"/tmp/magnum-nodes/sonobuoy",
|
||||
"--kubeconfig",
|
||||
"/tmp/magnum-nodes/kube.conf"])
|
||||
|
|
|
@ -256,6 +256,11 @@ users:
|
|||
except Exception as e:
|
||||
self.LOG.debug("kubectl exception: %s\n" % e)
|
||||
raise
|
||||
try:
|
||||
self.run_sonobuoy()
|
||||
except Exception as e:
|
||||
self.LOG.debug("sonobuoy exception: %s\n" % e)
|
||||
raise
|
||||
|
||||
# test cluster delete
|
||||
self._delete_cluster(cluster_model.uuid)
|
||||
|
|
Loading…
Reference in New Issue