From 6723ae3d063e2e14cbc9995c0a423dcebba96f98 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Mar 2025 15:01:11 +0100 Subject: [PATCH] Bug 39304: Make sure git commands return something Jenkins is not failing when git command fails. We edited the config and it broke the git repo: 13:32:35 koha_1 | error: unable to normalize alternate object path: /srv/jenkins/workspace/Koha_Source/.git/objects 13:32:35 koha_1 | fatal: not a tree object 13:32:35 koha_1 | [12:29:31] xt/check_makefile.t So tests were not running correctly Maybe it will be a problem for people running the tests without being inside a git repo, but for now we need to ensure the community CI does what we think it does. --- t/Makefile.t | 3 ++- xt/check_makefile.t | 7 ++++--- xt/find-missing-csrf.t | 3 ++- xt/find-missing-filters.t | 3 ++- xt/find-missing-op-in-forms.t | 3 ++- xt/single_quotes.t | 3 ++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/t/Makefile.t b/t/Makefile.t index 4a4814de6b8..e183a879aef 100755 --- a/t/Makefile.t +++ b/t/Makefile.t @@ -16,10 +16,11 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use File::Slurp; my @files = `git ls-tree HEAD|tr -s '\t' ' '|cut -d' ' -f4`; +ok( @files > 0, 'We should test something' ); my $MakeFile = read_file('Makefile.PL'); my @MakeFile = split "\n", $MakeFile; diff --git a/xt/check_makefile.t b/xt/check_makefile.t index 9a9c07bae4a..bbdb4ccb3e0 100755 --- a/xt/check_makefile.t +++ b/xt/check_makefile.t @@ -19,14 +19,15 @@ use Modern::Perl; use Test::More; -plan tests => 1; +plan tests => 2; use File::Spec; use File::Slurp qw( read_file ); use Data::Dumper; -my $curdir = File::Spec->curdir(); -my @dirs = `git ls-tree -d --name-only HEAD`; +my $curdir = File::Spec->curdir(); +my @dirs = `git ls-tree -d --name-only HEAD`; +ok( @dirs > 0, 'We should test something' ); my $makefile = read_file("$curdir/Makefile.PL"); my @missing; for my $d ( sort @dirs ) { diff --git a/xt/find-missing-csrf.t b/xt/find-missing-csrf.t index c4d559043b5..c10d7ee6b12 100755 --- a/xt/find-missing-csrf.t +++ b/xt/find-missing-csrf.t @@ -18,7 +18,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use File::Slurp; use Data::Dumper; @@ -31,6 +31,7 @@ push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`; # Staff push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`; push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`; +ok( @files > 0, 'We should test something' ); my @errors; for my $file (@files) { diff --git a/xt/find-missing-filters.t b/xt/find-missing-filters.t index e0003568a6b..0aefa3707c5 100755 --- a/xt/find-missing-filters.t +++ b/xt/find-missing-filters.t @@ -16,7 +16,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use File::Slurp qw( read_file ); use Data::Dumper; use t::lib::QA::TemplateFilters; @@ -30,6 +30,7 @@ push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`; # Staff push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`; push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`; +ok( @files > 0, 'We should test something' ); my @errors; for my $file (@files) { diff --git a/xt/find-missing-op-in-forms.t b/xt/find-missing-op-in-forms.t index 772f82c9e33..840d8b994ba 100755 --- a/xt/find-missing-op-in-forms.t +++ b/xt/find-missing-op-in-forms.t @@ -18,7 +18,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use File::Slurp; use Data::Dumper; @@ -31,6 +31,7 @@ push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`; # Staff push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`; push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`; +ok( @files > 0, 'We should test something' ); my @errors; for my $file (@files) { diff --git a/xt/single_quotes.t b/xt/single_quotes.t index feda36ba593..0e84e4fc0e6 100755 --- a/xt/single_quotes.t +++ b/xt/single_quotes.t @@ -18,7 +18,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use File::Slurp qw( read_file ); my @files; @@ -30,6 +30,7 @@ push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`; # Staff push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`; push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`; +ok( @files > 0, 'We should test something' ); my @errors; for my $file (@files) { -- 2.34.1