Page MenuHomeSoftware Heritage

test_loader: assert returned loader status is what we expect
ClosedPublic

Authored by douardda on Jun 4 2020, 4:33 PM.

Details

Summary

otherwise it's pointless to check in details what has been loaded.

Diff Detail

Repository
rDLDSVN Subversion (SVN) loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build has FAILED

Patch application report for D3227 (id=11442)

Rebasing onto 20e7618fed...

Current branch diff-target is up to date.
Changes applied before test
commit ea0b24494a3a297c25a1256d52e3914750db7110
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Jun 4 16:23:14 2020 +0200

    test_loader: assert returned loader status is what we expect
    
    otherwise it's pointless to check in details what has been loaded.

Link to build: https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/15/
See console output for more information: https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/15/console

Right.


Build has FAILED

Test that fails:

16:35:00  ___________________________ SvnLoaderTest3.test_load ___________________________
16:35:00  
16:35:00  self = <swh.loader.svn.tests.test_loader.SvnLoaderTest3 testMethod=test_load>
16:35:00  
16:35:00      def test_load(self):
16:35:00          """Load known repository with history altered should do nothing
16:35:00      
16:35:00          """
16:35:00          # when
16:35:00  >       assert self.loader.load() == {"status": "uneventful"}
16:35:00  E       AssertionError: assert {'status': 'failed'} == {'status': 'uneventful'}
16:35:00  E         Differing items:
16:35:00  E         {'status': 'failed'} != {'status': 'uneventful'}
16:35:00  E         Full diff:
16:35:00  E         - {'status': 'uneventful'}
16:35:00  E         + {'status': 'failed'}

It's because, the code changed recently when no snapshot and no revision is
provided when building a snapshot [1]. It now raises when before it did
nothing.

As this load status was not tested properly prior to your diff, the status
change passed undetected.

So I guess, it's fine to change from {"status": "uneventful"} to
{"status": "failed"} for the history altered scenario (as it's most possibly what we
want).

[1] D3208

Build is green

Patch application report for D3227 (id=11477)

Rebasing onto 20e7618fed...

Current branch diff-target is up to date.
Changes applied before test
commit 2f08b0dfb7d1e9fd05050c37de6f60acef434388
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Jun 4 16:23:14 2020 +0200

    test_loader: assert returned loader status is what we expect
    
    otherwise it's pointless to check in details what has been loaded.
    For SvnLoaderTest3.test_load(), the uneventful->failed change is
    needed due to recent change introduced by a1a10d2da8e6.

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

This revision is now accepted and ready to land.Jun 5 2020, 6:29 PM