mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 04:50:30 +01:00
clients/tests: workaround unexpected output for offline test
This test calls "nmcli g" with a bogus D-Bus bus address. We expect a failure on stderr. On alpine:latest, the error however looks slightly different: b'size: 258\nlocation: src/tests/client/test-client.py:test_offline()/1\ncmd: $NMCLI g\nlang: C\nreturncode: 1\nstderr: 136 bytes\n>>>\nError: Could not create NMClient object: Key/Value pair 0, *invalid*, in address element *very:invalid* does not contain an equal sign.\n\n<<<\n' On ubuntu:16.04 and debian:9 we got: b"size: 258\nlocation: src/tests/client/test-client.py:test_offline()/1\ncmd: $NMCLI g\nlang: C\nreturncode: 1\nstderr: 136 bytes\n>>>\nError: Could not create NMClient object: Key/Value pair 0, 'invalid', in address element 'very:invalid' does not contain an equal sign.\n\n<<<\n" On fedora and most recent systemd we got: b'size: 258\nlocation: src/tests/client/test-client.py:test_offline()/1\ncmd: $NMCLI g\nlang: C\nreturncode: 1\nstderr: 136 bytes\n>>>\nError: Could not create NMClient object: Key/Value pair 0, ?invalid?, in address element ?very:invalid? does not contain an equal sign.\n\n<<<\n' This depends on the glib version (whether to print `%s', '%s', or “%s”). Also, as we run the application with lang=C, so that libc (I think) replaces Unicode with an ASCII character. Here musl and glibc behave differently. Workaround by replace the unexpected text.
This commit is contained in:
parent
e27152f315
commit
6aef83a556
2 changed files with 7 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ lang: C
|
|||
returncode: 1
|
||||
stderr: 136 bytes
|
||||
>>>
|
||||
Error: Could not create NMClient object: Key/Value pair 0, ?invalid?, in address element ?very:invalid? does not contain an equal sign.
|
||||
Error: Could not create NMClient object: Key/Value pair 0, 'invalid', in address element 'very:invalid' does not contain an equal sign.
|
||||
|
||||
<<<
|
||||
size: 319
|
||||
|
|
|
|||
|
|
@ -1725,6 +1725,12 @@ class TestNmcli(NmTestBase):
|
|||
self.call_nmcli(
|
||||
["g"],
|
||||
extra_env=no_dbus_env,
|
||||
replace_stderr=[
|
||||
Util.ReplaceTextUsingRegex(
|
||||
r"Key/Value pair 0, [*?']invalid[*?'], in address element [*?']very:invalid[*?'] does not contain an equal sign",
|
||||
"Key/Value pair 0, 'invalid', in address element 'very:invalid' does not contain an equal sign",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
replace_uuids = [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue