Koha/t/00-check-atomic-updates.t
Aleisha Amohia 80f8556619
Bug 31479: Option to skip t/00-check-atomic-updates.t when building custom packages
This enhancement adds an option to skip the check for leftover atomic
updates when building custom packages. This is particularly useful for
Koha providers or anyone else building Koha packages manually.

In practice, this could be run like: sudo CUSTOM_PACKAGE=1
./debian/build-git-snapshot -r ~/debian -v 21.11.01git -d

This test plan should all take place within the shell.
0. sudo koha-shell kohadev
1. Run prove t/00-check-atomic-updates.t and confirm the test passes
2. Add a fake atomic update to installer/data/mysql/atomicupdate/ . You
can use the example from
https://wiki.koha-community.org/wiki/Database_updates#How_to_write_an_atomicupdate_file
3. Run prove t/00-check-atomic-updates.t and notice the test fails
4. Set the CUSTOM_PACKAGE environment variable so we can test this. You
can either set on the commandline (using export) or in /etc/environment
(remember to run source /etc/environment so the changes are accessed)
5. Run prove t/00-check-atomic-updates.t and the test should now pass.

Sponsored-by: Catalyst IT
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-10 15:26:20 -03:00

41 lines
1.1 KiB
Perl
Executable file

# Copyright 2022 Mason James
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Test::More;
use File::Find;
SKIP: {
skip "Building custom packages", 1, if $ENV{'CUSTOM_PACKAGE'};
my $dir = ('installer/data/mysql/atomicupdate');
my @files;
find( \&wanted, $dir );
sub wanted {
push @files, $_;
return;
}
foreach my $f (@files) {
next if $f eq 'skeleton.pl';
unlike( $f, qr/.*pl$/, "check for unhandled atomic updates: $f" );
}
};
done_testing();