diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-06-27 11:31:48 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-06-27 19:38:11 +0200 |
commit | d1d3feacdbf061cf4115ceeadcb71d2142971757 (patch) | |
tree | 0901c361df47597b0d9f6c3ca324e8aa71010cf5 /functest_kubernetes | |
parent | b6df8876ebf5a110c7c895a681449364f4ef2fd0 (diff) |
Disable log dump
It avoids dumping logs at the end which requires gcloud configured (CI).
Then it partially reverts "Keep kubernetes sources" [1].
It now dumps e2e.test output in e2e.log as sonobuoy [2].
[1] https://gerrit.opnfv.org/gerrit/68106
[2] https://raw.githubusercontent.com/cncf/k8s-conformance/master/v1.15/kubeadm/e2e.log
Change-Id: I400e1cf92a8540eba3d40db1ed4237628921efe6
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest_kubernetes')
-rw-r--r-- | functest_kubernetes/k8stest.py | 10 | ||||
-rw-r--r-- | functest_kubernetes/test_k8stest.py | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/functest_kubernetes/k8stest.py b/functest_kubernetes/k8stest.py index c78959ca..8a31d6c1 100644 --- a/functest_kubernetes/k8stest.py +++ b/functest_kubernetes/k8stest.py @@ -46,7 +46,10 @@ class K8sTesting(testcase.TestCase): process = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = process.stdout.read().decode("utf-8") + boutput = process.stdout.read() + with open(os.path.join(self.res_dir, 'e2e.log'), 'wb') as foutput: + foutput.write(boutput) + output = boutput.decode("utf-8") if ('Error loading client' in output or 'Unexpected error' in output): raise Exception(output) @@ -122,7 +125,8 @@ class K8sSmokeTest(K8sTesting): super(K8sSmokeTest, self).__init__(**kwargs) self.cmd = ['e2e.test', '-ginkgo.focus', 'Guestbook.application', '-ginkgo.noColor', '-kubeconfig', self.config, - '-provider', 'local', '-report-dir', self.res_dir] + '-provider', 'local', '-report-dir', self.res_dir, + '-disable-log-dump', 'true'] class K8sConformanceTest(K8sTesting): @@ -135,4 +139,4 @@ class K8sConformanceTest(K8sTesting): 'e2e.test', '-ginkgo.focus', r'\[Conformance\]', '-ginkgo.noColor', '-ginkgo.skip', r'Alpha|\[(Disruptive|Feature:[^\]]+|Flaky)\]', '-kubeconfig', self.config, '-provider', 'local', - '-report-dir', self.res_dir] + '-report-dir', self.res_dir, '-disable-log-dump', 'true'] diff --git a/functest_kubernetes/test_k8stest.py b/functest_kubernetes/test_k8stest.py index b03bb6dc..a94fdf88 100644 --- a/functest_kubernetes/test_k8stest.py +++ b/functest_kubernetes/test_k8stest.py @@ -64,6 +64,7 @@ class K8sTests(unittest.TestCase): mock_logger.exception.assert_called_with( "Error with running kubetest:") + @mock.patch('six.moves.builtins.open', mock.mock_open()) @mock.patch('functest_kubernetes.k8stest.os.path.isfile') @mock.patch('functest_kubernetes.k8stest.subprocess.Popen') def test_run(self, mock_open, mock_isfile): |