Page MenuHomeSoftware Heritage

Ensure server tests and fixtures properly clean up the global flask app
AbandonedPublic

Authored by olasd on Mar 4 2022, 12:58 PM.

Details

Reviewers
vlorentz
Maniphest Tasks
Restricted Maniphest Task
Summary

The global variable vault gets reused across test runs, so it needs to
be reset on fixture/test teardown, or any potential new config may not
be taken into account, which can in turn generate confusing postgresql
connection closures.

Depends on D7291

Test Plan

pytest with pytest-random-order

Diff Detail

Repository
rDVAU Software Heritage Vault
Branch
diff/26392
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27280
Build 42673: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 42672: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D7292 (id=26394)

Could not rebase; Attempt merge onto 252aa1464d...

Updating 252aa14..869421e
Fast-forward
 swh/vault/api/server.py        | 72 +++++++++++++++++---------------------
 swh/vault/tests/test_server.py | 78 +++++++++++++++++++++++-------------------
 2 files changed, 74 insertions(+), 76 deletions(-)
Changes applied before test
commit 869421e8e7171f2107c54932e686e4db4d138467
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Mar 4 12:47:38 2022 +0100

    Ensure server tests and fixtures properly clean up the global flask app
    
    The global variable `vault` gets reused across test runs, so it needs to
    be reset on fixture/test teardown, or any potential new config may not
    be taken into account, which can in turn generate confusing postgresql
    connection closures.

commit 2a80c26d2e902984eaef0c1fd3393f3eb73c9c87
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Mar 4 11:08:31 2022 +0100

    Rewrite the server to use flask instead of aiohttp
    
    The azure backend cannot be run in the same thread as an asyncio
    event loop: https://forge.softwareheritage.org/T3981

See https://jenkins.softwareheritage.org/job/DVAU/job/tests-on-diff/221/ for more details.

olasd requested review of this revision.Mar 4 2022, 1:00 PM
vlorentz added a task: Restricted Maniphest Task.Mar 7 2022, 9:25 AM