Page MenuHomeSoftware Heritage

server: Return SearchQuerySyntaxError as 400 instead of 500
ClosedPublic

Authored by vlorentz on Mar 25 2022, 4:57 PM.

Details

Reviewers
ardumont
Group Reviewers
Reviewers
Maniphest Tasks
Restricted Maniphest Task
Summary

It is caused by a client error; and raising it as 500 prevents the RPC client
from re-raising it using the right class.

Test Plan

D7435 makes one of the test trigger this code path

Diff Detail

Repository
rDSEA Archive search
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27837
Build 43579: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 43578: arc lint + arc unit

Event Timeline

vlorentz added a task: Restricted Maniphest Task.Mar 25 2022, 4:58 PM

Build is green

Patch application report for D7436 (id=26920)

Could not rebase; Attempt merge onto d273b070b0...

Merge made by the 'recursive' strategy.
 swh/search/api/server.py               |   6 +
 swh/search/tests/test_api_client.py    |   6 +-
 swh/search/tests/test_elasticsearch.py | 214 +++++++++++++++++----------------
 3 files changed, 122 insertions(+), 104 deletions(-)
Changes applied before test
commit 463c8df4d676f18516d433b1b217f5f7a0ddca6e
Merge: d273b07 7133b31
Author: Jenkins user <jenkins@localhost>
Date:   Fri Mar 25 15:57:16 2022 +0000

    Merge branch 'diff-target' into HEAD

commit 7133b310c01303b8f1dc8650056824f89fb4a43e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Mar 25 16:56:51 2022 +0100

    server: Return SearchQuerySyntaxError as 400 instead of 500
    
    It is caused by a client error; and raising it as 500 prevents the RPC client
    from re-raising it using the right class.

commit 18976d1015f6cd5ca0474c5db449df1df63195bc
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Mar 25 16:55:49 2022 +0100

    test_api_client.py: Also run tests from test_elasticsearch.py when possible
    
    In addition to test_search.py, which do not include search QL tests

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

Build is green

Patch application report for D7436 (id=26922)

Could not rebase; Attempt merge onto d273b070b0...

Merge made by the 'recursive' strategy.
 swh/search/api/server.py               |   6 +
 swh/search/tests/test_api_client.py    |   6 +-
 swh/search/tests/test_elasticsearch.py | 214 +++++++++++++++++----------------
 3 files changed, 122 insertions(+), 104 deletions(-)
Changes applied before test
commit f2cba326291e48e047eac3565734462ab66e5ad7
Merge: d273b07 5182f87
Author: Jenkins user <jenkins@localhost>
Date:   Fri Mar 25 16:19:09 2022 +0000

    Merge branch 'diff-target' into HEAD

commit 5182f870f8394476a232938b8021455532e6b453
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Mar 25 16:56:51 2022 +0100

    server: Return SearchQuerySyntaxError as 400 instead of 500
    
    It is caused by a client error; and raising it as 500 prevents the RPC client
    from re-raising it using the right class.

commit 38ff258b55122060691381b150e36b908b40f7c3
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Mar 25 16:55:49 2022 +0100

    test_api_client.py: Also run tests from test_elasticsearch.py when possible
    
    In addition to test_search.py, which do not include search QL tests

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

Build is green

Patch application report for D7436 (id=26924)

Rebasing onto d273b070b0...

First, rewinding head to replay your work on top of it...
Applying: server: Return SearchQuerySyntaxError as 400 instead of 500
Changes applied before test
commit d7cd57e4392def3e6287fbf2d8a862e6ac4e8169
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Mar 25 16:56:51 2022 +0100

    server: Return SearchQuerySyntaxError as 400 instead of 500
    
    It is caused by a client error; and raising it as 500 prevents the RPC client
    from re-raising it using the right class.

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

This revision is now accepted and ready to land.Mar 25 2022, 6:03 PM