Bugzilla – Attachment 55839 Details for
Bug 17360
Test the installer process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17360: Test the installer
Bug-17360-Test-the-installer.patch (text/plain), 3.45 KB, created by
Jonathan Druart
on 2016-09-27 12:51:12 UTC
(
hide
)
Description:
Bug 17360: Test the installer
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-09-27 12:51:12 UTC
Size:
3.45 KB
patch
obsolete
>From 98a4959dfb0a29a39c95018fb971b2fb54f4f0fc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 27 Sep 2016 13:50:36 +0100 >Subject: [PATCH] Bug 17360: Test the installer > >On bug 16554, we needed a script to test that all the .sql files were >correctly inserted. It could be reuse later (and pushed?). >--- > t/db_dependent/Test_installer.t | 79 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 79 insertions(+) > create mode 100644 t/db_dependent/Test_installer.t > >diff --git a/t/db_dependent/Test_installer.t b/t/db_dependent/Test_installer.t >new file mode 100644 >index 0000000..640993b >--- /dev/null >+++ b/t/db_dependent/Test_installer.t >@@ -0,0 +1,79 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use Test::More; #tests => XXX; >+use File::Find; >+use File::Slurp; >+use List::MoreUtils qw( uniq ); >+use t::lib::Mocks; >+use C4::Installer; >+ >+my $db_name = 'koha_test_installer'; >+t::lib::Mocks::mock_config('database', $db_name); >+my $user = C4::Context->config('user'); >+my $pass = C4::Context->config('pass'); >+my $schema = Koha::Database->new->schema; >+ >+my $sample_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/'; >+my @global_files = ( >+ $sample_dir . 'audio_alerts.sql', >+ $sample_dir . 'sysprefs.sql', >+ $sample_dir . 'userflags.sql', >+ $sample_dir . 'userpermissions.sql', >+ $sample_dir . 'mandatory/subtag_registry.sql', >+); >+my $kohastructure = $sample_dir . '/kohastructure.sql'; >+ >+for my $lang ( qw ( de-DE en es-ES fr-CA fr-FR it-IT nb-NO pl-PL ru-RU uk-UA ) ) { >+ next if $lang eq "ru-RU" or $lang eq "uk-UA"; # Some files are broken and need to be fixed >+ >+ next unless $lang eq 'uk-UA'; >+ >+ my $fr_pass = 1; >+ for my $marcflavour ( qw( marc21 unimarc ) ) { >+ say "loading kohastructure for $lang | not $marcflavour"; >+ recreate_db( $db_name ); >+ my $error = C4::Installer->new->load_sql( $kohastructure ); >+ my @sample_files; >+ >+ find( sub { >+ push @sample_files, $File::Find::name if $_ =~ m|\.sql$|; >+ }, $sample_dir . '/mandatory/' >+ ); >+ >+ find( sub { >+ my $filepath = $File::Find::name; >+ if ( $lang eq 'fr-FR' and $filepath =~ m|/marcflavour/| and $marcflavour eq 'marc21') { >+ if ( $fr_pass == 1 ) { >+ push @sample_files, $filepath if $filepath =~ m|\.sql$| and $filepath =~ m|/unimarc_complet/|; >+ } else { >+ push @sample_files, $filepath if $filepath =~ m|\.sql$| and $filepath =~ m|/unimarc_lecture_pub/|; >+ } >+ $fr_pass++; >+ } else { >+ push @sample_files, $filepath if $filepath =~ m|\.sql$|; >+ } >+ }, $sample_dir . $lang . '/' >+ ); >+ @sample_files = ( @global_files, sort @sample_files ); >+ my $i = 1; >+ for my $sql_file ( @sample_files ) { >+ print $i++ . "/" . scalar @sample_files . "\r"; flush STDOUT; >+ next if $sql_file =~ $marcflavour; >+ my $error = C4::Installer->new->load_sql( $sql_file ); >+ warn $error if $error; >+ } >+ } >+} >+ >+sub recreate_db { >+ my $dbname = shift; >+ my $dbh = C4::Context->dbh; >+ eval { $dbh->do(qq|DROP DATABASE $dbname|) }; >+ >+ $dbh->do(qq|CREATE DATABASE $dbname CHARACTER SET utf8 COLLATE utf8_bin|); >+ >+ # Force C4::Context to recreate a new db handler >+ $dbh->disconnect; >+} >-- >2.8.1
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 17360
: 55839