Bugzilla – Attachment 61306 Details for
Bug 9988
Leave larger authority merges to merge_authorities cronjob (pref AuthorityMergeLimit)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9988: Add a subtest for specific postponed merge issues
Bug-9988-Add-a-subtest-for-specific-postponed-merg.patch (text/plain), 3.58 KB, created by
Marcel de Rooy
on 2017-03-20 14:25:50 UTC
(
hide
)
Description:
Bug 9988: Add a subtest for specific postponed merge issues
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-03-20 14:25:50 UTC
Size:
3.58 KB
patch
obsolete
>From 4175352ebd6938006352f7969843435260740456 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 23 Feb 2017 12:46:52 +0100 >Subject: [PATCH] Bug 9988: Add a subtest for specific postponed merge issues >Content-Type: text/plain; charset=utf-8 > >This subtest shows that we need a few little tweaks to make merge >work in some specific postponed merge situations. > >Test plan: >[1] Run t/db_dependent/Authorities/Merge.t. > The last subtest should fail. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Authorities/Merge.t | 45 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Authorities/Merge.t b/t/db_dependent/Authorities/Merge.t >index d4c9cfe..0ae6124 100755 >--- a/t/db_dependent/Authorities/Merge.t >+++ b/t/db_dependent/Authorities/Merge.t >@@ -4,7 +4,7 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > > use Getopt::Long; > use MARC::Record; >@@ -286,6 +286,49 @@ subtest 'Merging authorities should handle deletes (BZ 18070)' => sub { > is( $marc1->field('609'), undef, 'Merge removed the 609 again even after deleting the authority record' ); > }; > >+subtest "Test some specific postponed merge issues" => sub { >+ plan tests => 4; >+ >+ my $authmarc = MARC::Record->new; >+ $authmarc->append_fields( MARC::Field->new( '109', '', '', 'a' => 'aa', b => 'bb' )); >+ my $oldauthmarc = MARC::Record->new; >+ $oldauthmarc->append_fields( MARC::Field->new( '112', '', '', c => 'cc' )); >+ my $id = AddAuthority( $authmarc, undef, $authtype1 ); >+ my $biblio = MARC::Record->new; >+ $biblio->append_fields( >+ MARC::Field->new( '109', '', '', a => 'a1', 9 => $id ), >+ MARC::Field->new( '612', '', '', a => 'a2', c => 'cc', 9 => $id+1 ), >+ MARC::Field->new( '612', '', '', a => 'a3', 9 => $id+2 ), >+ ); >+ my ( $biblionumber ) = C4::Biblio::AddBiblio( $biblio, '' ); >+ >+ # Merge A to B postponed, A is deleted (simulated by id+1) >+ # This proves the !authtypefrom condition in sub merge >+ # Additionally, we test clearing subfield >+ merge({ mergefrom => $id + 1, MARCfrom => $oldauthmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] }); >+ $biblio = C4::Biblio::GetMarcBiblio( $biblionumber ); >+ is( $biblio->subfield('609', '9'), $id, '612 moved to 609' ); >+ is( $biblio->subfield('609', 'c'), undef, '609c cleared correctly' ); >+ >+ # Merge A to B postponed, delete B immediately (hits B < hits A) >+ # This proves the !@record_to test in sub merge >+ merge({ mergefrom => $id + 2, mergeto => $id + 1, MARCto => undef, biblionumbers => [ $biblionumber ] }); >+ $biblio = C4::Biblio::GetMarcBiblio( $biblionumber ); >+ is( $biblio->field('612'), undef, 'Last 612 must be gone' ); >+ >+ # Show that we 'need' skip_merge; this example is far-fetched. >+ # We *prove* by contradiction. >+ # Suppose: Merge A to B postponed, and delete A would merge rightaway. >+ # (You would need some special race condition with merge.pl to do so.) >+ # The modify merge would be useless after that. >+ @linkedrecords = ( $biblionumber ); >+ my $restored_mocks = set_mocks(); >+ DelAuthority({ authid => $id }); # delete A >+ $restored_mocks->{auth_mod}->unmock_all; >+ $biblio = C4::Biblio::GetMarcBiblio( $biblionumber ); >+ is( $biblio->subfield('109', '9'), $id, 'If the 109 is no longer present, another modify merge would not bring it back' ); >+}; >+ > sub set_mocks { > # After we removed the Zebra code from merge, we only need to mock > # get_usage_count and linked_biblionumbers here. >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9988
:
59158
|
59159
|
60256
|
60257
|
60258
|
60259
|
60594
|
60595
|
60596
|
60597
|
60598
|
60599
|
60600
|
60601
|
60602
|
60603
|
60604
|
60605
|
60606
|
60607
|
60668
|
60669
|
60670
|
60671
|
60672
|
60673
|
60674
|
60675
|
61306
|
61307
|
61308
|
61309
|
61779
|
61780
|
61781
|
61782
|
61783
|
61784
|
61785
|
61786
|
61787
|
61788
|
61789
|
61790
|
61791
|
61792
|
61890
|
61891
|
61892
|
61893
|
61894
|
61895
|
61897
|
61898
|
61899
|
61900
|
61901
|
61902
|
61903
|
61904
|
61912
|
61913
|
61914
|
61915
|
61916
|
61917
|
61918
|
61919
|
61920
|
61921
|
61922
|
61923
|
61924
|
61925
|
62055
|
62123
|
62124
|
62125
|
62126
|
62127
|
62128
|
62129
|
62130
|
62131
|
62132
|
62133
|
62134
|
62135
|
62136
|
62137