From 610e03d33b6748420013ad98fc373a9117af919c Mon Sep 17 00:00:00 2001 From: Grzegorz Grasza Date: Fri, 23 Aug 2019 11:27:58 +0200 Subject: [PATCH] Additional logging in functional tests Print setup-ipa-client.log in case the enrollment test fails. Change-Id: I8980da9da9e9edfc95c58345bff7bde722677f81 --- novajoin/tests/functional/test_enrollment.py | 12 ++++++++++-- playbooks/functional/post.yaml | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/novajoin/tests/functional/test_enrollment.py b/novajoin/tests/functional/test_enrollment.py index 3e49181..d260a15 100644 --- a/novajoin/tests/functional/test_enrollment.py +++ b/novajoin/tests/functional/test_enrollment.py @@ -167,6 +167,13 @@ class TestEnrollment(testtools.TestCase): tries -= 1 else: # cloud-init script finished break + + # Save setup-ipa-client.log, to be collected by Zuul. + stdin, stdout, stderr = ssh.exec_command( + 'cat /var/log/setup-ipa-client.log') + with open('/tmp/setup-ipa-client.log', 'w') as log: + log.write(stdout.read().decode("utf-8")) + stdin, stdout, stderr = ssh.exec_command('id admin') self.assertRegex( 'uid=\d+\(admin\) gid=\d+\(admins\) groups=\d+\(admins\)', @@ -195,6 +202,9 @@ class TestEnrollment(testtools.TestCase): def test_enroll_server(self): self._create_server() self._associate_floating_ip() + + self._check_ipa_client_install() + self._check_ipa_client_created() self._check_ip_record_added() self._disassociate_floating_ip() @@ -202,8 +212,6 @@ class TestEnrollment(testtools.TestCase): self._associate_floating_ip() self._check_ip_record_added() - self._check_ipa_client_install() - self._check_server_compact_services(['http\\test1', 'http\\test2']) self._update_server_compact_service_new() diff --git a/playbooks/functional/post.yaml b/playbooks/functional/post.yaml index 2e23a9d..37eee4a 100644 --- a/playbooks/functional/post.yaml +++ b/playbooks/functional/post.yaml @@ -31,3 +31,11 @@ src: "/var/log/novajoin" verify_host: true failed_when: false + + - name: Collect setup ipa client log + synchronize: + dest: "{{ zuul.executor.log_root }}" + mode: pull + src: "/tmp/setup-ipa-client.log" + verify_host: true + failed_when: false