Skip to content

Commit

Permalink
Merge pull request #6039 from Martchus/git-clone-default
Browse files Browse the repository at this point in the history
Enable automatic updates of test code and needles by default
  • Loading branch information
mergify[bot] authored Oct 31, 2024
2 parents 26048c5 + e932030 commit e466e05
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 20 deletions.
31 changes: 18 additions & 13 deletions docs/GettingStarted.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ distri:: a test distribution but also sometimes referring to a _product_
multiple _test modules_ in a folder structure that compose _test suites_, e.g.
"opensuse" (test distribution, short for "os-autoinst-distri-opensuse")

needles:: reference images to assert whether what is on the screen matches
expectations and to locate elements on the screen the tests needs to interact
with (e.g. to locate a button to click on it)

product:: the main "system under test" (SUT), e.g. "openSUSE", also called
"Medium Types" in the web interface of openQA

Expand Down Expand Up @@ -369,22 +373,23 @@ this document should help you to get started faster.
You can point `CASEDIR` and `NEEDLES_DIR` to Git repositories. openQA will
checkout those repositories automatically and no manual setup is needed.

Otherwise you will need to clone tests and needles manually. First you need to
get actual tests. You can get openSUSE tests and needles (the expected results)
from https://github.com/os-autoinst/os-autoinst-distri-opensuse[GitHub]. It
belongs into the `/var/lib/openqa/tests/opensuse` directory. To make it easier,
you can just run:
Otherwise you will need to clone tests and needles manually. For this,
clone a subdirectory under `/var/lib/openqa/tests` for each test distribution
you need, e.g. `/var/lib/openqa/tests/opensuse` for openSUSE tests.

[source,sh]
--------------------------------------------------------------------------------
/usr/share/openqa/script/fetchneedles
--------------------------------------------------------------------------------
The repositories will be kept up-to-date if `git_auto_update` is enabled in
`openqa.ini` (which is the default). The updating is triggered when new tests
are scheduled. For a periodic update (to avoid getting too far behind) you can
enable the systemd unit `openqa-enqueue-git-auto-update.timer`.

Which will download the tests to the correct location and will set the correct
rights as well.
You can get openSUSE tests and needles from
https://github.com/os-autoinst/os-autoinst-distri-opensuse[GitHub]. To make it
easier, you can just run `/usr/share/openqa/script/fetchneedles`. It will
download tests and needles to the correct location with the correct permissions.

Fedora's tests are also in https://pagure.io/fedora-qa/os-autoinst-distri-fedora[git]. To
use them, you may do:
Fedora's tests are also in
https://pagure.io/fedora-qa/os-autoinst-distri-fedora[git]. To use them, you may
do:

[source,sh]
--------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions etc/openqa/openqa.ini
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
#do_push = no
## whether to clone CASEDIR or NEEDLES_DIR on the web UI if that var points to a Git repo
#git_auto_clone = yes
## Experimental - Ensure a git update of all test code and needles
#git_auto_update = no
## enable automatic updates of all test code and needles managed via Git
#git_auto_update = yes

## Authentication method to use for user management
[auth]
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sub read_config ($app) {
do_push => 'no',
do_cleanup => 'no',
git_auto_clone => 'yes',
git_auto_update => 'no',
git_auto_update => 'yes',
},
scheduler => {
max_job_scheduled_time => 7,
Expand Down
4 changes: 3 additions & 1 deletion t/15-assets.t
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ ok($schema = OpenQA::Test::Database->new->create, 'create database')
|| BAIL_OUT('failed to create database');

my $t = Test::Mojo->new('OpenQA::WebAPI');
$t->app->config->{global}->{hide_asset_types} = 'repo foo ';
my $cfg = $t->app->config;
$cfg->{global}->{hide_asset_types} = 'repo foo ';
$cfg->{'scm git'}->{git_auto_update} = 'no';

embed_server_for_testing(
server_name => 'OpenQA::WebSockets',
Expand Down
1 change: 1 addition & 0 deletions t/23-amqp.t
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ my $t = client(Test::Mojo->new('OpenQA::WebAPI'));
my $app = $t->app;
my $schema = $app->schema;
my $comments = $schema->resultset('Comments');
$app->config->{'scm git'}->{git_auto_update} = 'no';

# create a parent group
my $parent_groups = $schema->resultset('JobGroupParents');
Expand Down
1 change: 1 addition & 0 deletions t/43-cli-schedule.t
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ my $app = $daemon->build_app('OpenQA::WebAPI');
my $port = $daemon->start->ports->[0];
my $host = "http://127.0.0.1:$port";
$app->log->level($ENV{HARNESS_IS_VERBOSE} ? 'debug' : 'error');
$app->config->{'scm git'}->{git_auto_update} = 'no';

combined_like { OpenQA::CLI->new->run('help', 'schedule') } qr/Usage: openqa-cli schedule/, 'help';
subtest 'unknown options' => sub {
Expand Down
4 changes: 3 additions & 1 deletion t/api/04-jobs.t
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ sub calculate_file_md5 ($file) {
$ENV{MOJO_MAX_MESSAGE_SIZE} = 207741824;

my $t = client(Test::Mojo->new('OpenQA::WebAPI'));
is($t->app->config->{audit}->{blocklist}, 'job_grab', 'blocklist updated');
my $cfg = $t->app->config;
$cfg->{'scm git'}->{git_auto_update} = 'no';
is $cfg->{audit}->{blocklist}, 'job_grab', 'blocklist updated';

my $schema = $t->app->schema;
my $assets = $schema->resultset('Assets');
Expand Down
1 change: 1 addition & 0 deletions t/api/08-jobtemplates.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $log_mock->redefine(error => sub { push @logged_errors, $_[1] });

my $accept_yaml = {Accept => 'text/yaml'};
my $t = client(Test::Mojo->new('OpenQA::WebAPI'), apikey => 'ARTHURKEY01', apisecret => 'EXCALIBUR');
$t->app->config->{'scm git'}->{git_auto_update} = 'no';

my $schema = $t->app->schema;
my $job_groups = $schema->resultset('JobGroups');
Expand Down
2 changes: 1 addition & 1 deletion t/config.t
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ subtest 'Test configuration default modes' => sub {
do_push => 'no',
do_cleanup => 'no',
git_auto_clone => 'yes',
git_auto_update => 'no',
git_auto_update => 'yes',
},
'scheduler' => {
max_job_scheduled_time => 7,
Expand Down
3 changes: 3 additions & 0 deletions t/data/openqa.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
title = Some preset
distri = does-not-exist
casedir = http://foo.git

[scm git]
git_auto_update = no
3 changes: 2 additions & 1 deletion t/ui/01-list.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ use OpenQA::SeleniumTest;
my $t = Test::Mojo->new('OpenQA::WebAPI');

$ENV{OPENQA_CONFIG} = my $config_dir = tempdir("$FindBin::Script-XXXX");
$config_dir->child('openqa.ini')->spew("[scheduler]\nmax_running_jobs = 3");
my $cfg = "[scheduler]\nmax_running_jobs = 3\n[scm git]\ngit_auto_update = no";
$config_dir->child('openqa.ini')->spew($cfg);

my @job_params = (
group_id => 1002,
Expand Down

0 comments on commit e466e05

Please sign in to comment.