support/testing: python-magic-wormhole: fix random failures

The magic-wormhole "receive" command can output "waiting" messages
when key receival or verification are longer than a predefined
timeout:
https://github.com/magic-wormhole/magic-wormhole/blob/0.13.0/src/wormhole/cli/cmd_receive.py#L135

The intent is to have an interactive user experience.

This behavior makes the runtime test unreliable as the test always
expect the sent message as the exact output. When the test execution
is slower, it sometimes get the "waiting" message instead of the
expected message.

Some test jobs are succeeding:
https://gitlab.com/buildroot.org/buildroot/-/jobs/4968059737
while some other are failing.

magic-wormhole can override those timers with environment variables.
See:
https://github.com/magic-wormhole/magic-wormhole/blob/0.13.0/src/wormhole/cli/cmd_receive.py#L26

This commit sets those environment variable to larger values
(100 seconds instread of 1 by default), to make sure the test will
always pass.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/4962923235

Reported-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
Tested-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Julien Olivain 2023-08-31 19:37:36 +02:00 committed by Thomas Petazzoni
parent aab82a29bc
commit d44a888c32

View File

@ -50,7 +50,9 @@ class TestPythonPy3MagicWormhole(TestPythonPackageBase):
cmd += "sleep 25"
self.assertRunOk(cmd, timeout=30)
cmd = wormhole_cmd + " receive {}".format(code)
wormhole_env = "_MAGIC_WORMHOLE_TEST_KEY_TIMER=100 "
wormhole_env += "_MAGIC_WORMHOLE_TEST_VERIFY_TIMER=100 "
cmd = wormhole_env + wormhole_cmd + " receive {}".format(code)
output, exit_code = self.emulator.run(cmd, timeout=35)
self.assertEqual(exit_code, 0)
self.assertEqual(output[0], text)