mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-05 14:09:53 +03:00
As reported by our gitlab runtime test [1] and on the mailing list [2], the test_python_django is failing 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 passes. 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]6e45e33f27Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Adam Duskett <Aduskett@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit3e6b97e09e) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from tests.package.test_python import TestPythonPackageBase
|
|
|
|
|
|
class TestPythonDjango(TestPythonPackageBase):
|
|
config = TestPythonPackageBase.config
|
|
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=timeout)
|
|
|
|
cmd = "cd /opt/testsite && " + self.interpreter + " ./manage.py migrate"
|
|
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 {}".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)
|
|
|
|
|
|
class TestPythonPy3Django(TestPythonDjango):
|
|
__test__ = True
|
|
config = TestPythonDjango.config + \
|
|
"""
|
|
BR2_PACKAGE_PYTHON3=y
|
|
BR2_PACKAGE_PYTHON_DJANGO=y
|
|
BR2_PACKAGE_PYTHON3_SQLITE=y
|
|
"""
|