[PATCH 12/15] tests/functional: logs details of console interaction operations

Daniel P. Berrangé posted 15 patches 4 days, 3 hours ago
There is a newer version of this series
[PATCH 12/15] tests/functional: logs details of console interaction operations
Posted by Daniel P. Berrangé 4 days, 3 hours ago
When functional tests go wrong, it will often be related to the console
interaction wait state. By logging the messages that we're looking for,
and data we're about to be sending, it'll be easier to diagnose where
tests are getting stuck.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/functional/qemu_test/cmd.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
index cbabb1ceed..76a48064cd 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -85,6 +85,8 @@ def _console_interaction(test, success_message, failure_message,
         vm = test.vm
     console = vm.console_file
     console_logger = logging.getLogger('console')
+    test.log.debug(f"Console interaction success:'{success_message}' " +
+                   f"failure:'{failure_message}' send:'{send_string}'")
     while True:
         if send_string:
             vm.console_socket.sendall(send_string.encode())
-- 
2.46.0


Re: [PATCH 12/15] tests/functional: logs details of console interaction operations
Posted by Thomas Huth 2 days, 11 hours ago
On 19/11/2024 16.05, Daniel P. Berrangé wrote:
> When functional tests go wrong, it will often be related to the console
> interaction wait state. By logging the messages that we're looking for,
> and data we're about to be sending, it'll be easier to diagnose where
> tests are getting stuck.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   tests/functional/qemu_test/cmd.py | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index cbabb1ceed..76a48064cd 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -85,6 +85,8 @@ def _console_interaction(test, success_message, failure_message,
>           vm = test.vm
>       console = vm.console_file
>       console_logger = logging.getLogger('console')
> +    test.log.debug(f"Console interaction success:'{success_message}' " +

I have to admit that I had to read the message twice to really understand 
it. Since the message starts with "Console interaction success", I thought 
that this message means that we successfully matched a string already.

So maybe rather change the text to read:

  Console interaction: success_msg=... failure_msg=...

?

  Thomas