Project

General

Profile

Autre #37224

non déterminisme dans les tests du ProxyLogger

Added by Benjamin Dauvergne 8 months ago. Updated 8 months ago.

Status:
Rejeté
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
25 Oct 2019
Due date:
% Done:

0%

Patch proposed:
No
Planning:
No

Description

De temps en temps :

tests.test_proxylogger.test_log_on_connector_availability_change[0] (from pytest)
En échec depuis 1 build (Depuis En échec#6 )
A duré 0,22 s.
Ajouter une description
Message d'erreur

assert 'connector "é.../example.net/' == 'GET http://ex...net/ (=> 404)'   - connector "éléphant" (Feed) is now down: 404 Client Error: None for url: http://example.net/   + GET http://example.net/ (=> 404)

Pile d'exécution

db = None, connector = <Feed: éléphant>
freezer = <freezegun.api.FrozenDateTimeFactory object at 0x7f0179f56250>
notification_delays = '0'

    @pytest.mark.parametrize('notification_delays', ['0', '0,5,100', '5,100'])
    def test_log_on_connector_availability_change(db, connector, freezer, notification_delays):
        connector.title = u'éléphant'
        availability_parameters = connector.availability_parameters
        availability_parameters.notification_delays = notification_delays
        availability_parameters.save()

        with HTTMock(up_mock):  # set connector as up
            connector.availability()
        assert ResourceLog.objects.count() == 1
        assert ResourceLog.objects.latest('id').level == 'info'
        assert ResourceLog.objects.latest('id').message == 'GET http://example.net/ (=> 200)'
        ResourceLog.objects.all().delete()

        # move 5 minutes in the future
        freezer.move_to(datetime.timedelta(seconds=60 * 5 + 1))

        with HTTMock(down_mock):  # set connector as down
            connector.availability()
        assert connector.down()
        last_count1 = ResourceLog.objects.count()
        assert last_count1 == 2
>       assert ResourceLog.objects.all()[0].message == 'GET http://example.net/ (=> 404)'
E       assert 'connector "é.../example.net/' == 'GET http://ex...net/ (=> 404)'
E         - connector "éléphant" (Feed) is now down: 404 Client Error: None for url: http://example.net/
E         + GET http://example.net/ (=> 404)

tests/test_proxylogger.py:181: AssertionError

Sortie d'erreur standard

GET http://example.net/ (=> 200)
[INFO] GET http://example.net/ (=> 200)
GET http://example.net/ (=> 404)
[ERROR] GET http://example.net/ (=> 404)
connector "éléphant" (Feed) is now down: 404 Client Error: None for url: http://example.net/
[ERROR] connector "éléphant" (Feed) is now down: 404 Client Error: None for url: http://example.net/

Je pense que c'est du au freezer qui fige les dates et à un ordre naturel sur la colonne temps dans ResourceLog (je n'ai pas vérifié).


Related issues

Duplicates Passerelle - Support #32860: test proxylogger test_log_on_connector_availability_change est instable Nouveau 07 May 2019

History

#1 Updated by Frédéric Péters 8 months ago

  • Status changed from Nouveau to Rejeté

Déjà noté dans #32860.

#2 Updated by Frédéric Péters 8 months ago

  • Duplicates Support #32860: test proxylogger test_log_on_connector_availability_change est instable added

Also available in: Atom PDF