Skip to content

Commit fad3731

Browse files
authored
Merge pull request #6692 from d3flex/check-git-status
Check git status
2 parents 42965ea + ebf64fd commit fad3731

11 files changed

+32
-7
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
logs/*.tar.*
22
etc/mine/
3-
cover_db/
3+
# Devel::Cover
4+
/cover_db*
5+
# TAP::Harness::JUnit
6+
/test-results/
7+
# CircleCI cache
8+
/logs/
49
temp
510
/testresults
611
/t/data/openqa/webui/cache

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ test-with-database: node_modules setup-database
269269
test-unit-and-integration: node_modules
270270
export GLOBIGNORE="$(GLOBIGNORE)";\
271271
export DEVEL_COVER_DB_FORMAT=JSON;\
272-
export PERL5OPT="$(COVEROPT)$(PERL5OPT) -It/lib -I$(PWD)/t/lib -I$(PWD)/external/os-autoinst-common/lib -MOpenQA::Test::PatchDeparse";\
272+
export PERL5OPT="$(COVEROPT)$(PERL5OPT) -It/lib -I$(PWD)/t/lib -I$(PWD)/external/os-autoinst-common/lib $(CHECK_GIT_STATUS_OPT) -MOpenQA::Test::PatchDeparse";\
273273
RETRY=${RETRY} HOOK=./tools/delete-coverdb-folder timeout -s SIGINT -k 5 -v ${TIMEOUT_RETRIES} tools/retry "${PROVE}" ${PROVE_LIB_ARGS} ${PROVE_ARGS}
274274

275275
.PHONY: setup-database
@@ -299,6 +299,10 @@ COVERDB_SUFFIX ?=
299299
COVEROPT ?= -mJSON::PP -It/lib -MCoverageWorkaround -MDevel::Cover=-select_re,'^/lib',+ignore_re,lib/perlcritic/Perl/Critic/Policy|t/lib/CoverageWorkaround,-coverage,statement,-db,cover_db$(COVERDB_SUFFIX),
300300
endif
301301

302+
ifeq ($(CHECK_GIT_STATUS),1)
303+
CHECK_GIT_STATUS_OPT ?= -MTest::CheckGitStatus
304+
endif
305+
302306
.PHONY: coverage
303307
coverage:
304308
export DEVEL_COVER_DB_FORMAT=JSON;\

cpanfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ on 'develop' => sub {
119119
requires 'Perl::Critic';
120120
requires 'Perl::Critic::Community';
121121
requires 'Perl::Tidy', '== 20250711.0.0';
122+
requires 'Test::CheckGitStatus';
122123

123124
};
124125

dependencies.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ devel_no_selenium_requires:
8585
tar:
8686
xorg-x11-fonts:
8787
perl(Perl::Tidy): '== 20250711.0.0'
88+
perl(Test::CheckGitStatus):
8889

8990
devel_requires:
9091
'%devel_no_selenium_requires':

dist/rpm/openQA.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
# The following line is generated from dependencies.yaml
9595
%define cover_requires perl(Devel::Cover) perl(Devel::Cover::Report::Codecovbash)
9696
# The following line is generated from dependencies.yaml
97-
%define devel_no_selenium_requires %build_requires %cover_requires %qemu %style_check_requires %test_requires curl perl(Perl::Tidy) postgresql-devel rsync sudo tar xorg-x11-fonts
97+
%define devel_no_selenium_requires %build_requires %cover_requires %qemu %style_check_requires %test_requires curl perl(Perl::Tidy) perl(Test::CheckGitStatus) postgresql-devel rsync sudo tar xorg-x11-fonts
9898
# The following line is generated from dependencies.yaml
9999
%define devel_requires %devel_no_selenium_requires chromedriver
100100

t/32-openqa_client.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ use Test::Warnings ':report_warnings';
88
use FindBin;
99
use lib "$FindBin::Bin/lib", "$FindBin::Bin/../external/os-autoinst-common/lib";
1010
use Test::Mojo;
11-
use Mojo::File qw(tempfile path);
11+
use Mojo::File qw(tempfile path tempdir);
1212
use OpenQA::Events;
1313
use OpenQA::Test::Case;
1414
use OpenQA::Test::Client 'client';
1515
use OpenQA::Test::TimeLimit '80';
16+
use Mojo::Util qw(scope_guard);
1617

1718
plan skip_all => 'set HEAVY=1 to execute (takes longer)' unless $ENV{HEAVY};
1819

@@ -22,6 +23,10 @@ my $chunk_size = 10000000;
2223
# allow up to 200MB - videos mostly
2324
$ENV{MOJO_MAX_MESSAGE_SIZE} = 207741824;
2425

26+
my $tempdir = tempdir("$FindBin::Script-XXXX", TMPDIR => 1);
27+
chdir $tempdir;
28+
my $guard = scope_guard sub { chdir $FindBin::Bin };
29+
2530
my @client_args = (apikey => 'PERCIVALKEY02', apisecret => 'PERCIVALSECRET02');
2631
my $t = client(Test::Mojo->new('OpenQA::WebAPI'), @client_args);
2732
my $client = $t->ua;

t/37-limit_assets.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use Test::Most;
66

77
use FindBin;
88
use lib "$FindBin::Bin/lib", "$FindBin::Bin/../external/os-autoinst-common/lib";
9-
use Mojo::File 'path';
9+
use Mojo::File qw(path tempdir);
1010
use Test::Mojo;
1111
use Test::Warnings ':report_warnings';
1212
use Test::MockModule;
@@ -41,6 +41,8 @@ my $assets = $schema->resultset('Assets');
4141
# assume some assets already have a last_use_job_id
4242
$assets->find($_)->update({last_use_job_id => 99963}) for (2, 3);
4343

44+
my $tempdir = tempdir("$FindBin::Script-XXXX", TMPDIR => 1);
45+
4446
note('Asset directory: ' . assetdir());
4547

4648
subtest 'configurable concurrency' => sub {
@@ -55,6 +57,7 @@ subtest 'configurable concurrency' => sub {
5557
};
5658

5759
subtest 'filesystem removal' => sub {
60+
local $ENV{OPENQA_SHAREDIR} = "$tempdir/openqa";
5861
my $asset_sub_dir = path(assetdir(), 'foo');
5962
$asset_sub_dir->remove_tree->make_path;
6063

t/43-scheduling-and-worker-scalability.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use File::Path 'make_path';
1212
use Scalar::Util 'looks_like_number';
1313
use List::Util qw(min max);
1414
use Mojo::File qw(path tempfile);
15-
use Mojo::Util 'dumper';
15+
use Mojo::Util qw(dumper scope_guard);
1616
use IPC::Run qw(start);
1717
use FindBin;
1818
use lib "$FindBin::Bin/lib", "$FindBin::Bin/../external/os-autoinst-common/lib";
@@ -56,6 +56,8 @@ note('Set SCALABILITY_TEST_WORKER_COUNT/SCALABILITY_TEST_JOB_COUNT to adjust thi
5656

5757
# setup basedir, config dir and database
5858
my $tempdir = setup_fullstack_temp_dir('scalability');
59+
chdir $tempdir;
60+
my $guard = scope_guard sub { chdir $FindBin::Bin };
5961
my $schema = OpenQA::Test::Database->new->create;
6062
my $workers = $schema->resultset('Workers');
6163
my $jobs = $schema->resultset('Jobs');

t/api/04-jobs.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use FindBin;
99
use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../external/os-autoinst-common/lib";
1010
use Mojo::Base -signatures;
1111
use File::Temp;
12+
use File::Copy::Recursive qw(dircopy);
1213
use Test::Mojo;
1314
use Test::Output;
1415
use Test::Warnings ':report_warnings';
@@ -39,7 +40,7 @@ $ENV{OPENQA_BASEDIR} = $tempdir;
3940
note("OPENQA_BASEDIR: $tempdir");
4041
path($tempdir, '/openqa/testresults')->make_path;
4142
my $share_dir = path($tempdir, 'openqa/share')->make_path;
42-
symlink "$FindBin::Bin/../data/openqa/share/factory", "$share_dir/factory";
43+
dircopy("$FindBin::Bin/../data/openqa/share/factory", "$share_dir/factory");
4344

4445
# ensure job events are logged
4546
$ENV{OPENQA_CONFIG} = $tempdir;

tools/ci/ci-packages.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ perl-SUPER-1.20141117
222222
perl-Syntax-Keyword-Try-0.28
223223
perl-TAP-Harness-JUnit-0.42
224224
perl-Task-Weaken-1.06
225+
perl-Test-CheckGitStatus
225226
perl-Test-Deep-1.127
226227
perl-Test-Differences-0.64
227228
perl-Test-Exception-0.430000

0 commit comments

Comments
 (0)