From b40722be50ce6094200238d3d9be05f1fdf60e51 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 Content-Type: text/plain; charset=utf-8 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. Signed-off-by: Marcel de Rooy --- t/Makefile.t | 1 + 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, 13 insertions(+), 7 deletions(-) diff --git a/t/Makefile.t b/t/Makefile.t index dc3e88dcc9..69cf23c57a 100755 --- a/t/Makefile.t +++ b/t/Makefile.t @@ -21,6 +21,7 @@ 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 9a9c07bae4..bbdb4ccb3e 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 c4d559043b..c10d7ee6b1 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 e0003568a6..0aefa3707c 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 772f82c9e3..840d8b994b 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 feda36ba59..0e84e4fc0e 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.39.5