Skip to contentSkip to conversation

support/testing: test_python_django: use the timeout_multiplier value

PATCH New Romain Naour 2 participants 2 messages Apr 11, 2020 – Apr 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/testing: test_python_django: use the timeout_multiplier value

As reported by our gitlab runtime test [1] and on the mailing list [2], the test_python_django is failing only on gitlab due to slow (but free) gitlab runners. This is due to django server taking a lot of time to start. Since the django server is started in background through pexpect, we can't easily wait for the last startup line:

"January 01, 1970 - 00:00:41

Django version 3.0.4, using settings 'testsite.settings'

Starting development server at http://0.0.0.0:1234/

Quit the server with CONTROL-C."

In the failing gitlab job, we don't see such lines.

If we increase a lot the timout, the test pass.

Use timeout_multiplier introduced by [3] in order to adjust the timeout.

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

Tested:
https://gitlab.com/kubu93/buildroot/-/jobs/507458355

[1] https://gitlab.com/buildroot.org/buildroot/-/jobs/488816222
[2] http://lists.busybox.net/pipermail/buildroot/2020-April/279598.html
[3] 6e45e33f27d5ae6fa0ab5aad3f032d886a886037

---
This patch should be backported to 2020.02.x

---
 support/testing/tests/package/test_python_django.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
support/testing/tests/package/test_python_django.py +6 -4
index 6b31833a0f..0b7d35bb6a 100644
@@ -6,18 +6,20 @@ class TestPythonDjango(TestPythonPackageBase):
     sample_scripts = ["tests/package/sample_python_django.py"]
 
     def run_sample_scripts(self):
+        timeout = 35 * self.emulator.timeout_multiplier
+
         cmd = "cd /opt && /usr/bin/django-admin startproject testsite"
-        self.assertRunOk(cmd, timeout=30)
+        self.assertRunOk(cmd, timeout=timeout)
 
         cmd = "cd /opt/testsite && " + self.interpreter + " ./manage.py migrate"
-        output, exit_code = self.emulator.run(cmd, timeout=30)
+        output, exit_code = self.emulator.run(cmd, timeout=timeout)
         self.assertIn("Operations to perform:", output[0])
         self.assertEqual(exit_code, 0)
 
         cmd = "cd /opt/testsite && " + self.interpreter + " ./manage.py runserver 0.0.0.0:1234 & "
         # give some time to setup the server
-        cmd += "sleep 30"
-        self.assertRunOk(cmd, timeout=35)
+        cmd += "sleep {}".format(str(30 * self.emulator.timeout_multiplier))
+        self.assertRunOk(cmd, timeout=timeout)
 
         cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234"
         self.assertRunOk(cmd)
Signature · 1 line
2.25.2
#1 lore raw

PATCH 1/1 support/testing: test_python_django: use the timeout_multiplier value

Quoted 3 lines · On Sat, 11 Apr 2020 16:57:50 +0200 Romain Naour <[email protected]> wrote:

As reported by our gitlab runtime test [1] and on the mailing list [2], the test_python_django is failing only on gitlab due to slow (but free) gitlab runners.

The particular job you point to was running on gcc159, not on a free Gitlab runner. All the CI done on the official Buildroot Gitlab account is done on our own machines (gcc159, gcc160, Mind build server and Bootlin build server), not on free Gitlab runners.

That being said, it makes complete sense to use the timeout_multiplier here, so I've slightly tweaked your commit log and applied.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com