Bug 19169

Summary: Add a test to detect unneeded 'atomicupdate' files
Product: Koha Reporter: Mason James <mtj>
Component: Test SuiteAssignee: Mason James <mtj>
Status: Pushed to oldoldoldstable --- QA Contact: Testopia <testopia>
Severity: blocker    
Priority: P1 - high CC: andrew, chris, jonathan.druart, kyle, mtj, victor, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29596
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31108
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.05,21.05.14,20.11.18,19.11.29
Circulation function:
Bug Depends on:    
Bug Blocks: 31108    
Attachments: Bug 19169: Add a test to detect unneeded 'atomicupdate' files
Bug 19169: Add a test to detect unneeded 'atomicupdate' files
Bug 19169: Add a test to detect unneeded 'atomicupdate' files

Description Mason James 2017-08-24 07:20:50 UTC
Add a test to detect unneeded 'atomicupdate' files
Comment 1 Jonathan Druart 2017-09-27 17:14:56 UTC
What do you mean?
Comment 2 Jonathan Druart 2017-09-27 17:17:09 UTC
Are you asking for something in the release tools, like a git hook?
I use one I can share if you want.
Comment 3 Mason James 2022-03-05 03:55:39 UTC
Created attachment 131394 [details] [review]
Bug 19169: Add a test to detect unneeded 'atomicupdate' files

to test...

1/ set git repo
    $ git reset --hard v21.11.03

2/ run test
    $ prove ./t
    OK

3/ apply patch

4/ run test again, observe FAIL

    $ prove ./t/00-check-atomic-updates.pl
    ./t/00-check-atomic-updates.pl .. 1/?
    #   Failed test 'check for unhandled atomic updates: bug_29596.pl'
    #   at ./t/00-check-atomic-updates.pl line 34.
    #                   'bug_29596.pl'
    #           matches '(?^u:.*pl$)'
    # Looks like you failed 1 test of 3.
    ./t/00-check-atomic-updates.pl .. Dubious, test returned 1 (wstat 256, 0x100)
    Failed 1/3 subtests
Comment 4 Mason James 2022-03-05 04:01:19 UTC
(In reply to Jonathan Druart from comment #2)
> Are you asking for something in the release tools, like a git hook?
> I use one I can share if you want.

hi Jonathan

i added a test so we can catch this problem early, before the release :)
Comment 5 Jonathan Druart 2022-03-07 10:01:50 UTC
All RM and RMaints must have a pre-push hook with the following code in it.

    my @atomicupdate_files = `git show HEAD:installer/data/mysql/atomicupdate/|tr -s '\\n' | grep -v '^tree'|grep -v 'README'|grep -v skeleton`;
    chomp for @atomicupdate_files;
    for my $atomic ( @atomicupdate_files ) { 
        push @errors, "Atomicupdate file exists - $atomic";
    }
Comment 6 Jonathan Druart 2022-03-07 10:05:55 UTC
Created attachment 131429 [details] [review]
Bug 19169: Add a test to detect unneeded 'atomicupdate' files

to test...

1/ set git repo
    $ git reset --hard v21.11.03

2/ run test
    $ prove ./t
    OK

3/ apply patch

4/ run test again, observe FAIL

    $ prove ./t/00-check-atomic-updates.pl
    ./t/00-check-atomic-updates.pl .. 1/?
    #   Failed test 'check for unhandled atomic updates: bug_29596.pl'
    #   at ./t/00-check-atomic-updates.pl line 34.
    #                   'bug_29596.pl'
    #           matches '(?^u:.*pl$)'
    # Looks like you failed 1 test of 3.
    ./t/00-check-atomic-updates.pl .. Dubious, test returned 1 (wstat 256, 0x100)
    Failed 1/3 subtests

JD Amended patch: fix copyright year
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Katrin Fischer 2022-03-07 19:15:44 UTC
(In reply to Jonathan Druart from comment #5)
> All RM and RMaints must have a pre-push hook with the following code in it.
> 
>     my @atomicupdate_files = `git show
> HEAD:installer/data/mysql/atomicupdate/|tr -s '\\n' | grep -v '^tree'|grep
> -v 'README'|grep -v skeleton`;
>     chomp for @atomicupdate_files;
>     for my $atomic ( @atomicupdate_files ) { 
>         push @errors, "Atomicupdate file exists - $atomic";
>     }

Should we add this to https://wiki.koha-community.org/wiki/Release_maintenance or 
https://wiki.koha-community.org/wiki/Tips_and_tricks#pre-push?

Maybe we could also do a version of the RMaint pre-push hook that includes this check?
Comment 8 Katrin Fischer 2022-03-07 20:02:10 UTC
Created attachment 131445 [details] [review]
Bug 19169: Add a test to detect unneeded 'atomicupdate' files

to test...

1/ set git repo
    $ git reset --hard v21.11.03

2/ run test
    $ prove ./t
    OK

3/ apply patch

4/ run test again, observe FAIL

    $ prove ./t/00-check-atomic-updates.pl
    ./t/00-check-atomic-updates.pl .. 1/?
    #   Failed test 'check for unhandled atomic updates: bug_29596.pl'
    #   at ./t/00-check-atomic-updates.pl line 34.
    #                   'bug_29596.pl'
    #           matches '(?^u:.*pl$)'
    # Looks like you failed 1 test of 3.
    ./t/00-check-atomic-updates.pl .. Dubious, test returned 1 (wstat 256, 0x100)
    Failed 1/3 subtests

JD Amended patch: fix copyright year
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Jonathan Druart 2022-03-08 14:15:01 UTC
(In reply to Katrin Fischer from comment #7)
> Should we add this to
> https://wiki.koha-community.org/wiki/Release_maintenance or 
> https://wiki.koha-community.org/wiki/Tips_and_tricks#pre-push?

It's there already.
Comment 10 Fridolin Somers 2022-03-16 08:31:32 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑
Comment 11 Mason James 2022-03-25 04:46:32 UTC
(In reply to Fridolin Somers from comment #10)
> Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑

can we apply this thru to 19.11 pleeese
Comment 12 Kyle M Hall (khall) 2022-03-25 12:15:02 UTC
Pushed to 21.11.x for 21.11.05
Comment 13 Andrew Fuerste-Henry 2022-04-25 19:55:55 UTC
Pushed to 21.05.x for 21.05.14
Comment 14 Victor Grousset/tuxayo 2022-04-25 20:53:48 UTC
Backported: Pushed to 20.11.x branch for 20.11.18
Comment 15 Victor Grousset/tuxayo 2022-05-12 05:04:51 UTC
Note: has been backported and pushed to 19.11.x branch for 19.11.29