Development #68260
Test flaky sur /api/agendas/recurring-events/
0%
Description
Rencontré ponctuellement sur Jenkins, J'avais fait un correctif similaire dans #68025.
cachedir: /tmp/tox-jenkins/chrono/wip/68248-Interdire-le-clic-sur-l-URL-d-un/py3-django22-codestyle-coverage/.pytest_cache django: settings: chrono.settings (from env) rootdir: /var/lib/jenkins/workspace/Interdire-le-clic-sur-l-URL-d-un plugins: django-4.5.2, cov-3.0.0, forked-1.4.0, freezegun-0.4.2, django-webtest-1.9.10, xdist-2.5.0 gw0 I / gw1 I / gw2 I gw0 [1002] / gw1 [1002] / gw2 [1002] ........................................................................ [ 7%] ........................................................................ [ 14%] ........................................................................ [ 21%] ........................................................................ [ 28%] ........................................................................ [ 35%] ........................................................................ [ 43%] ........................................................................ [ 50%] ........................................................................ [ 57%] .....F.................................................................. [ 64%] ........................................................................ [ 71%] ........................................................................ [ 79%] ........................................................................ [ 86%] ........................................................................ [ 93%] .................................................................. [100%] =================================== FAILURES =================================== ______________ test_recurring_events_api_list_overlapping_events _______________ [gw2] linux -- Python 3.9.2 /tmp/tox-jenkins/chrono/wip/68248-Interdire-le-clic-sur-l-URL-d-un/py3-django22-codestyle-coverage/bin/python app = <django_webtest.DjangoTestApp object at 0x7f664554eeb0> @pytest.mark.freeze_time('2021-09-06 12:00') def test_recurring_events_api_list_overlapping_events(app): agenda = Agenda.objects.create(label='First Agenda', kind='events') Desk.objects.create(agenda=agenda, slug='_exceptions_holder') start, end = now(), now() + datetime.timedelta(days=30) Event.objects.create( label='Event 12-14', start_datetime=start, duration=120, places=2, recurrence_end_date=end, recurrence_days=[1], agenda=agenda, ) Event.objects.create( label='Event 14-15', start_datetime=start + datetime.timedelta(hours=2), duration=60, places=2, recurrence_end_date=end, recurrence_days=[1], agenda=agenda, ) Event.objects.create( label='Event 15-17', start_datetime=start + datetime.timedelta(hours=3), duration=120, places=2, recurrence_end_date=end, recurrence_days=[1, 3, 5], agenda=agenda, ) agenda2 = Agenda.objects.create(label='Second Agenda', kind='events') Desk.objects.create(agenda=agenda2, slug='_exceptions_holder') Event.objects.create( label='Event 12-18', start_datetime=start, duration=360, places=2, recurrence_end_date=end, recurrence_days=[1, 5], agenda=agenda2, ) Event.objects.create( label='No duration', start_datetime=start, places=2, recurrence_end_date=end, recurrence_days=[5], agenda=agenda2, ) resp = app.get( '/api/agendas/recurring-events/?agendas=first-agenda,second-agenda&sort=day&check_overlaps=true' ) > assert [(x['id'], x['overlaps']) for x in resp.json['data']] == [ ('first-agenda@event-12-14:1', ['second-agenda@event-12-18:1']), ( 'second-agenda@event-12-18:1', ['first-agenda@event-12-14:1', 'first-agenda@event-14-15:1', 'first-agenda@event-15-17:1'], ), ('first-agenda@event-14-15:1', ['second-agenda@event-12-18:1']), ('first-agenda@event-15-17:1', ['second-agenda@event-12-18:1']), ('first-agenda@event-15-17:3', []), ('second-agenda@event-12-18:5', ['first-agenda@event-15-17:5']), ('second-agenda@no-duration:5', []), ('first-agenda@event-15-17:5', ['second-agenda@event-12-18:5']), ] E AssertionError: assert [('first-agen...-17:5']), ...] == [('first-agen...-17:5']), ...] E At index 1 diff: ('second-agenda@event-12-18:1', ['first-agenda@event-15-17:1', 'first-agenda@event-14-15:1', 'first-agenda@event-12-14:1']) != ('second-agenda@event-12-18:1', ['first-agenda@event-12-14:1', 'first-agenda@event-14-15:1', 'first-agenda@event-15-17:1']) E Use -v to get more diff tests/api/datetimes/test_recurring_events.py:549: AssertionError =============================== warnings summary ===============================
Files
Related issues
Associated revisions
django3: fix django 3 being installed in django 2 test env in CI (#68260)
History
Updated by A. B. about 2 years ago
- Related to Development #68248: Interdire le clic sur l'URL d'une source d'exception contenant un gabarit added
Updated by A. B. about 2 years ago
- File 0001-misc-fixed-flaky-test-on-api-agendas-recurring-event.patch 0001-misc-fixed-flaky-test-on-api-agendas-recurring-event.patch added
- Status changed from Nouveau to Solution proposée
- Patch proposed changed from No to Yes
Updated by A. B. about 2 years ago
Visiblement, l'ordering des données retournées n'est pas stable, en utilisant des set, on peut tester l'égalité sans tenir compte de l'ordering.
Updated by A. B. about 2 years ago
Deux autres tests qui pêtent sur Jenkins (alors que je n'ai modifié que du code d'un test dans mon patch…):
__________________________ test_booking_api_fillslots __________________________ [gw2] linux -- Python 3.9.2 /tmp/tox-jenkins/chrono/wip/68260-Test-flaky-sur-api-agendas-recur/py3-django22-codestyle-coverage/bin/python app = <django_webtest.DjangoTestApp object at 0x7f5f2d4a4370> user = <User: john.doe> def test_booking_api_fillslots(app, user): agenda = Agenda.objects.create(label='Foo bar', kind='events') events = [] for i in range(3): events.append( Event.objects.create( label='Event', start_datetime=now() + datetime.timedelta(days=5 + i), places=20, agenda=agenda ) ) events_ids = [x.id for x in events] events_slugs = [x.slug for x in events] event = events[0] # unauthenticated resp = app.post('/api/agenda/%s/fillslots/' % agenda.slug, status=401) for agenda_key in (agenda.slug, agenda.id): # acces datetimes via agenda slug or id (legacy) resp_datetimes = app.get('/api/agenda/%s/datetimes/' % agenda_key) api_event_slugs = [x['id'] for x in resp_datetimes.json['data']] > assert api_event_slugs == events_slugs E AssertionError: assert ['event-1', '...t', 'event-2'] == ['event', 'ev...1', 'event-2'] E At index 0 diff: 'event-1' != 'event' E Use -v to get more diff tests/api/fillslot/test_all.py:449: AssertionError ------------------------------ Captured log call ------------------------------- WARNING django.request:log.py:224 Unauthorized: /api/agenda/foo-bar/fillslots/ __________________________ test_booking_api_available __________________________ [gw2] linux -- Python 3.9.2 /tmp/tox-jenkins/chrono/wip/68260-Test-flaky-sur-api-agendas-recur/py3-django22-codestyle-coverage/bin/python app = <django_webtest.DjangoTestApp object at 0x7f5f2d7d4400> user = <User: john.doe> def test_booking_api_available(app, user): agenda = Agenda.objects.create(label='Foo bar', kind='events', minimal_booking_delay=0) for i in range(0, 10): event = Event.objects.create( slug='event-slug%i' % i, start_datetime=(now() + datetime.timedelta(days=5)).replace(hour=10, minute=i), places=20, agenda=agenda, ) app.authorization = ('Basic', ('john.doe', 'password')) with CaptureQueriesContext(connection) as ctx: resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug) assert len(ctx.captured_queries) == 3 assert resp.json['data'][-1]['places']['total'] == 20 assert resp.json['data'][-1]['places']['available'] == 20 assert resp.json['data'][-1]['places']['reserved'] == 0 assert resp.json['data'][-1]['places']['full'] is False assert 'waiting_list_total' not in resp.json['data'][-1]['places'] resp = app.post_json('/api/agenda/%s/fillslot/%s/' % (agenda.pk, event.pk)) assert resp.json['err'] == 0 assert resp.json['places']['total'] == 20 assert resp.json['places']['available'] == 19 assert resp.json['places']['reserved'] == 1 assert resp.json['places']['full'] is False assert 'waiting_list_total' not in resp.json['places'] resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug) assert resp.json['data'][-1]['places']['total'] == 20 > assert resp.json['data'][-1]['places']['available'] == 19 E assert 20 == 19 tests/api/fillslot/test_all.py:1022: AssertionError =============================== warnings summary =============================== <pre>
Updated by Valentin Deniaud about 2 years ago
Mmmmh ce qui est flippant c'est que les tests plantent en django22, mais en fait non j'ai l'impression que l'environnement django22 installe Django3.2 :/
Updated by A. B. about 2 years ago
Valentin Deniaud a écrit :
Mmmmh ce qui est flippant c'est que les tests plantent en django22, mais en fait non j'ai l'impression que l'environnement django22 installe Django3.2 :/
Oui… ça sent la dépendance qui force django 3 à un moment
Updated by A. B. about 2 years ago
c'est django-filter qui force une dépendance à django>=3.2,
$ pipdeptree chrono==2.54.post7+g286abba.dirty - django [required: >=2.2,<3.3, installed: 3.2.15] - asgiref [required: >=3.3.2,<4, installed: 3.5.2] - pytz [required: Any, installed: 2022.2.1] - sqlparse [required: >=0.2.2, installed: 0.4.2] - django-filter [required: Any, installed: 22.1] - Django [required: >=3.2, installed: 3.2.15] - asgiref [required: >=3.3.2,<4, installed: 3.5.2] - pytz [required: Any, installed: 2022.2.1] - sqlparse [required: >=0.2.2, installed: 0.4.2] - djangorestframework [required: >=3.4, installed: 3.13.1] - django [required: >=2.2, installed: 3.2.15] - asgiref [required: >=3.3.2,<4, installed: 3.5.2] - pytz [required: Any, installed: 2022.2.1] - sqlparse [required: >=0.2.2, installed: 0.4.2] - pytz [required: Any, installed: 2022.2.1] - gadjo [required: Any, installed: 1.18] - XStatic [required: Any, installed: 1.0.2] - XStatic-Font-Awesome [required: Any, installed: 4.7.0.0] - XStatic-jQuery [required: Any, installed: 3.5.1.1] - XStatic-jquery-ui [required: Any, installed: 1.13.0.1] - XStatic-jQuery [required: Any, installed: 3.5.1.1] - XStatic-OpenSans [required: Any, installed: 1.0.0] - python-dateutil [required: Any, installed: 2.8.2] - six [required: >=1.5, installed: 1.16.0] - requests [required: Any, installed: 2.28.1] - certifi [required: >=2017.4.17, installed: 2022.6.15] - charset-normalizer [required: >=2,<3, installed: 2.1.0] - idna [required: >=2.5,<4, installed: 3.3] - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.11] - vobject [required: Any, installed: 0.9.6.1] - python-dateutil [required: >=2.4.0, installed: 2.8.2] - six [required: >=1.5, installed: 1.16.0] - weasyprint [required: <0.43, installed: 0.42.3] - cairocffi [required: >=0.5, installed: 1.3.0] - cffi [required: >=1.1.0, installed: 1.15.1] - pycparser [required: Any, installed: 2.21] - CairoSVG [required: >=1.0.20, installed: 2.5.2] - cairocffi [required: Any, installed: 1.3.0] - cffi [required: >=1.1.0, installed: 1.15.1] - pycparser [required: Any, installed: 2.21] - cssselect2 [required: Any, installed: 0.6.0] - tinycss2 [required: Any, installed: 1.1.1] - webencodings [required: >=0.4, installed: 0.5.1] - webencodings [required: Any, installed: 0.5.1] - defusedxml [required: Any, installed: 0.7.1] - pillow [required: Any, installed: 9.2.0] - tinycss2 [required: Any, installed: 1.1.1] - webencodings [required: >=0.4, installed: 0.5.1] - cffi [required: >=0.6, installed: 1.15.1] - pycparser [required: Any, installed: 2.21] - cssselect2 [required: >=0.1, installed: 0.6.0] - tinycss2 [required: Any, installed: 1.1.1] - webencodings [required: >=0.4, installed: 0.5.1] - webencodings [required: Any, installed: 0.5.1] - html5lib [required: >=0.999999999, installed: 1.1] - six [required: >=1.9, installed: 1.16.0] - webencodings [required: Any, installed: 0.5.1] - pdfrw [required: >=0.4, installed: 0.4] - Pyphen [required: >=0.8, installed: 0.12.0] - tinycss2 [required: >=0.5, installed: 1.1.1] - webencodings [required: >=0.4, installed: 0.5.1] - workalendar [required: Any, installed: 16.3.0] - convertdate [required: Any, installed: 2.4.0] - pymeeus [required: >=0.3.13,<=1, installed: 0.5.11] - lunardate [required: Any, installed: 0.2.0] - pyluach [required: Any, installed: 2.0.0] - python-dateutil [required: Any, installed: 2.8.2] - six [required: >=1.5, installed: 1.16.0] django-mellon==1.34 - atomicwrites [required: Any, installed: 1.4.1] - django [required: >=2.2,<3.3, installed: 3.2.15] - asgiref [required: >=3.3.2,<4, installed: 3.5.2] - pytz [required: Any, installed: 2022.2.1] - sqlparse [required: >=0.2.2, installed: 0.4.2] - isodate [required: Any, installed: 0.6.1] - six [required: Any, installed: 1.16.0] - requests [required: Any, installed: 2.28.1] - certifi [required: >=2017.4.17, installed: 2022.6.15] - charset-normalizer [required: >=2,<3, installed: 2.1.0] - idna [required: >=2.5,<4, installed: 3.3] - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.11] django-webtest==1.9.10 - webtest [required: >=1.3.3, installed: 3.0.0] - beautifulsoup4 [required: Any, installed: 4.11.1] - soupsieve [required: >1.2, installed: 2.3.2.post1] - waitress [required: >=0.8.5, installed: 2.1.2] - WebOb [required: >=1.2, installed: 1.8.7] httmock==1.4.0 - requests [required: >=1.0.0, installed: 2.28.1] - certifi [required: >=2017.4.17, installed: 2022.6.15] - charset-normalizer [required: >=2,<3, installed: 2.1.0] - idna [required: >=2.5,<4, installed: 3.3] - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.11] mock==3.0.5 - six [required: Any, installed: 1.16.0] pipdeptree==2.2.1 - pip [required: >=6.0.0, installed: 22.2.2] psycopg2-binary==2.8.6 publik-django-templatetags==0.3 - django [required: Any, installed: 3.2.15] - asgiref [required: >=3.3.2,<4, installed: 3.5.2] - pytz [required: Any, installed: 2022.2.1] - sqlparse [required: >=0.2.2, installed: 0.4.2] - requests [required: Any, installed: 2.28.1] - certifi [required: >=2017.4.17, installed: 2022.6.15] - charset-normalizer [required: >=2,<3, installed: 2.1.0] - idna [required: >=2.5,<4, installed: 3.3] - urllib3 [required: >=1.21.1,<1.27, installed: 1.26.11] pylint-django==2.5.3 - pylint [required: >=2.0,<3, installed: 2.14.5] - astroid [required: >=2.11.6,<=2.12.0-dev0, installed: 2.11.7] - lazy-object-proxy [required: >=1.4.0, installed: 1.7.1] - setuptools [required: >=20.0, installed: 63.2.0] - wrapt [required: >=1.11,<2, installed: 1.14.1] - dill [required: >=0.2, installed: 0.3.5.1] - isort [required: >=4.2.5,<6, installed: 5.10.1] - mccabe [required: >=0.6,<0.8, installed: 0.7.0] - platformdirs [required: >=2.2.0, installed: 2.5.2] - tomli [required: >=1.1.0, installed: 2.0.1] - tomlkit [required: >=0.10.1, installed: 0.11.4] - pylint-plugin-utils [required: >=0.7, installed: 0.7] - pylint [required: >=1.7, installed: 2.14.5] - astroid [required: >=2.11.6,<=2.12.0-dev0, installed: 2.11.7] - lazy-object-proxy [required: >=1.4.0, installed: 1.7.1] - setuptools [required: >=20.0, installed: 63.2.0] - wrapt [required: >=1.11,<2, installed: 1.14.1] - dill [required: >=0.2, installed: 0.3.5.1] - isort [required: >=4.2.5,<6, installed: 5.10.1] - mccabe [required: >=0.6,<0.8, installed: 0.7.0] - platformdirs [required: >=2.2.0, installed: 2.5.2] - tomli [required: >=1.1.0, installed: 2.0.1] - tomlkit [required: >=0.10.1, installed: 0.11.4] pyquery==1.4.3 - cssselect [required: >0.7.9, installed: 1.1.0] - lxml [required: >=2.1, installed: 4.9.1] pytest-cov==3.0.0 - coverage [required: >=5.2.1, installed: 6.4.4] - pytest [required: >=4.6, installed: 7.1.2] - attrs [required: >=19.2.0, installed: 22.1.0] - iniconfig [required: Any, installed: 1.1.1] - packaging [required: Any, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pluggy [required: >=0.12,<2.0, installed: 1.0.0] - py [required: >=1.8.2, installed: 1.11.0] - tomli [required: >=1.0.0, installed: 2.0.1] pytest-django==4.5.2 - pytest [required: >=5.4.0, installed: 7.1.2] - attrs [required: >=19.2.0, installed: 22.1.0] - iniconfig [required: Any, installed: 1.1.1] - packaging [required: Any, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pluggy [required: >=0.12,<2.0, installed: 1.0.0] - py [required: >=1.8.2, installed: 1.11.0] - tomli [required: >=1.0.0, installed: 2.0.1] pytest-freezegun==0.4.2 - freezegun [required: >0.3, installed: 1.2.2] - python-dateutil [required: >=2.7, installed: 2.8.2] - six [required: >=1.5, installed: 1.16.0] - pytest [required: >=3.0.0, installed: 7.1.2] - attrs [required: >=19.2.0, installed: 22.1.0] - iniconfig [required: Any, installed: 1.1.1] - packaging [required: Any, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pluggy [required: >=0.12,<2.0, installed: 1.0.0] - py [required: >=1.8.2, installed: 1.11.0] - tomli [required: >=1.0.0, installed: 2.0.1] pytest-xdist==2.5.0 - execnet [required: >=1.1, installed: 1.9.0] - pytest [required: >=6.2.0, installed: 7.1.2] - attrs [required: >=19.2.0, installed: 22.1.0] - iniconfig [required: Any, installed: 1.1.1] - packaging [required: Any, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pluggy [required: >=0.12,<2.0, installed: 1.0.0] - py [required: >=1.8.2, installed: 1.11.0] - tomli [required: >=1.0.0, installed: 2.0.1] - pytest-forked [required: Any, installed: 1.4.0] - py [required: Any, installed: 1.11.0] - pytest [required: >=3.10, installed: 7.1.2] - attrs [required: >=19.2.0, installed: 22.1.0] - iniconfig [required: Any, installed: 1.1.1] - packaging [required: Any, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pluggy [required: >=0.12,<2.0, installed: 1.0.0] - py [required: >=1.8.2, installed: 1.11.0] - tomli [required: >=1.0.0, installed: 2.0.1] wheel==0.37.1
Updated by Frédéric Péters about 2 years ago
Au cas où, si tu connais un truc pour dire à tox "après avoir installé les modules vérifie que les versions correspondent à ce qui est listé dans le tox.ini", on prend, ça n'est pas la première fois qu'on est "surpris" ainsi.
Updated by A. B. about 2 years ago
Frédéric Péters a écrit :
Au cas où, si tu connais un truc pour dire à tox "après avoir installé les modules vérifie que les versions correspondent à ce qui est listé dans le tox.ini", on prend, ça n'est pas la première fois qu'on est "surpris" ainsi.
La solution fiable pour ce genre de choses c'est d'utiliser un gestionnaire de dépendances avec un lockfile comme Poetry ou Pipenv, pour éviter que chaque nouvelle release d'un projet (ici django-filter) puisse affecter la CI en installant silencieusement d'autres versions et des dépendances.
Updated by A. B. about 2 years ago
Updated by Valentin Deniaud about 2 years ago
- Status changed from Solution proposée to Solution validée
Tu pourras ouvrir un autre ticket pour les deux autres tests qui ont planté ?
Updated by A. B. about 2 years ago
- Status changed from Solution validée to Résolu (à déployer)
commit cf57c91aa84d1dc0ae4f690d57f293f8c3eeb2ee Author: Agate Berriot <aberriot@entrouvert.com> Date: Thu Aug 18 15:21:23 2022 +0200 django3: fix django 3 being installed in django 2 test env in CI (#68260) commit bc345dcbfa5a9bace3d81e64b3e600ad762b5855 Author: Agate Berriot <aberriot@entrouvert.com> Date: Thu Aug 18 14:37:36 2022 +0200 misc: fixed flaky test on /api/agendas/recurring-events/ (#68260)
Updated by A. B. about 2 years ago
- Related to Development #68268: Test flaky sur /api/agendas/ added
Updated by Transition automatique about 2 years ago
- Status changed from Résolu (à déployer) to Solution déployée
misc: fixed flaky test on /api/agendas/recurring-events/ (#68260)