Refactored integration test of openstacksdk logging feature

Instead of asserting that openstacksdk created a logging file,
we read the contents of that log file now. The benefit is, that
this integration test gives users an idea how to actually use the
logging feature and also read the contents of the log file.

Change-Id: I9e3c75dda4c1c920937c9780fbdcbe3caeb4d6ad
This commit is contained in:
Jakob Meng 2022-11-03 15:40:06 +01:00
parent d07778c24a
commit d0ac32eefd
1 changed files with 7 additions and 12 deletions

View File

@ -1,20 +1,15 @@
---
- name: Trigger flavor listing
- name: Trigger flavor listing to create logs
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
sdk_log_path: "{{ sdk_log_file_path }}"
sdk_log_level: "DEBUG"
- name: Check log file presence
ansible.builtin.stat:
path: "{{ sdk_log_file_path }}"
register: sdk_log_file
- name: Read openstacksdk's log file
ansible.builtin.slurp:
src: "{{ sdk_log_file_path }}"
register: log
- name: Assert
ansible.builtin.assert:
that:
- "sdk_log_file.stat.exists"
- name: Debug log file content
- name: Print contents of openstacksdk's log
ansible.builtin.debug:
msg: "{{ lookup('ansible.builtin.file', sdk_log_file_path) }}"
msg: "{{ log['content'] | b64decode }}"