Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package openQA for openSUSE:Factory checked in at 2026-11-26 15:54:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openQA (Old) and /work/SRC/openSUSE:Factory/.openQA.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openQA" Thu Nov 26 15:54:22 2026 rev:913 rq:1400663 version:5.1795626606.295f3489 Changes: -------- --- /work/SRC/openSUSE:Factory/openQA/openQA.changes 2026-11-24 17:03:11.830431627 +0100 +++ /work/SRC/openSUSE:Factory/.openQA.new.1340718/openQA.changes 2026-11-26 15:55:00.720835917 +0100 @@ -1,0 +2,13 @@ +Wed Nov 25 17:10:26 UTC 2026 - [email protected] + +- Update to version 5.1795626606.295f3489: + * feat(ui): Allow changing appearance without login + * feat(ui): Keep appearance settings in long-lived cookies + * chore(deps): Dependency cron 2026-11-25 + * fix(rest): map format to _format without rewriting the request URL + * fix(auth): hash the client-serialized query for API signatures + * test: Allow running `t/40-script_…git-refspec.t` under `landrun` + * feat: Allow running fullstack tests in confined test environment + * fix: keep screenshot links in dry-run cleanup + +------------------------------------------------------------------- Old: ---- openQA-5.1795520239.e4d21551.obscpio New: ---- openQA-5.1795626606.295f3489.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openQA-client-test.spec ++++++ --- /var/tmp/diff_new_pack.NieyCu/_old 2026-11-26 15:55:05.090020812 +0100 +++ /var/tmp/diff_new_pack.NieyCu/_new 2026-11-26 15:55:05.099021193 +0100 @@ -18,7 +18,7 @@ %define short_name openQA-client Name: %{short_name}-test -Version: 5.1795520239.e4d21551 +Version: 5.1795626606.295f3489 Release: 0 Summary: Test package for %{short_name} License: GPL-2.0-or-later ++++++ openQA-test.spec ++++++ --- /var/tmp/diff_new_pack.NieyCu/_old 2026-11-26 15:55:05.196025298 +0100 +++ /var/tmp/diff_new_pack.NieyCu/_new 2026-11-26 15:55:05.201025510 +0100 @@ -18,7 +18,7 @@ %define short_name openQA Name: %{short_name}-test -Version: 5.1795520239.e4d21551 +Version: 5.1795626606.295f3489 Release: 0 Summary: Test package for openQA License: GPL-2.0-or-later ++++++ openQA-worker-test.spec ++++++ --- /var/tmp/diff_new_pack.NieyCu/_old 2026-11-26 15:55:05.299029657 +0100 +++ /var/tmp/diff_new_pack.NieyCu/_new 2026-11-26 15:55:05.305029911 +0100 @@ -18,7 +18,7 @@ %define short_name openQA-worker Name: %{short_name}-test -Version: 5.1795520239.e4d21551 +Version: 5.1795626606.295f3489 Release: 0 Summary: Test package for %{short_name} License: GPL-2.0-or-later ++++++ openQA.spec ++++++ --- /var/tmp/diff_new_pack.NieyCu/_old 2026-11-26 15:55:05.402034016 +0100 +++ /var/tmp/diff_new_pack.NieyCu/_new 2026-11-26 15:55:05.406034185 +0100 @@ -104,7 +104,7 @@ %define devel_requires %devel_no_selenium_requires chromedriver Name: openQA -Version: 5.1795520239.e4d21551 +Version: 5.1795626606.295f3489 Release: 0 Summary: Framework for automated system-level testing (web-frontend, scheduler and tools) Group: Development/Tools/Other ++++++ openQA-5.1795520239.e4d21551.obscpio -> openQA-5.1795626606.295f3489.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/docs/UsersGuide.md new/openQA-5.1795626606.295f3489/docs/UsersGuide.md --- old/openQA-5.1795520239.e4d21551/docs/UsersGuide.md 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/docs/UsersGuide.md 2026-11-25 18:10:06.000000000 +0100 @@ -797,7 +797,8 @@ ### Dark mode -A dark mode theme can be enabled via "Appearance" settings for all logged in users. It can either be forced with +A dark mode theme can be enabled via "Appearance" settings, also without being logged in. The preferences are stored in +a browser cookie for one year, so they survive logout and session expiry. It can either be forced with the "dark mode" setting, or left to browser detection. Switching automatically between light and dark mode is natively supported by most modern browsers and can also be controlled manually via flags: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/Config.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/Config.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/Config.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/Config.pm 2026-11-25 18:10:06.000000000 +0100 @@ -58,8 +58,13 @@ my $extension = $main_config_file->extname; my $has_main_config = -r $main_config_file; $config_name //= $main_config_file->basename(".$extension"); - push @config_file_paths, $main_config_file if $has_main_config; - push @config_file_paths, @{$config_path->child("$name.d")->list->grep(qr/\.$extension$/)->sort}; + try { + push @config_file_paths, $main_config_file if $has_main_config; + push @config_file_paths, @{$config_path->child("$name.d")->list->grep(qr/\.$extension$/)->sort}; + } + catch ($e) { + log_warning(qq{Unable to add config files under "$config_path": $e}) unless $silent; + } last if $has_main_config; } if (@config_file_paths) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/Schema/Result/Jobs.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/Schema/Result/Jobs.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/Schema/Result/Jobs.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/Schema/Result/Jobs.pm 2026-11-25 18:10:06.000000000 +0100 @@ -1224,7 +1224,7 @@ deleted_size => \$deleted_size_screenshots, dry => $dry ); - $self->screenshot_links->delete; + $self->screenshot_links->delete unless $dry; $screenshot_deletion->delete_screenshot($_, $screenshots->find($_)->filename) for @$exclusively_used_screenshot_ids; $self->update({logs_present => 0, result_size => 0}) unless $dry; return ($deleted_size_res, $deleted_size_screenshots); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/Shared/Controller/Auth.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/Shared/Controller/Auth.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/Shared/Controller/Auth.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/Shared/Controller/Auth.pm 2026-11-25 18:10:06.000000000 +0100 @@ -34,7 +34,7 @@ # It has no expiration date or it's in the future if (!$exp || $exp->epoch > time) { if (my $secret = $api_key->secret) { - my $sum = hmac_sha1_sum($self->req->url->to_string . $remote_timestamp, $secret); + my $sum = hmac_sha1_sum($self->_signing_url . $remote_timestamp, $secret); $user = $api_key->user if secure_compare($hash, $sum); log_trace(sprintf 'API auth by user: %s, operator: %d', $user->username, $user->is_operator) if $user; @@ -188,6 +188,14 @@ return (undef, $reason); } +sub _signing_url ($self) { + # Clients sign the query re-serialized by Mojo::Parameters (see OpenQA::UserAgent::_path_query), so the + # verification must not depend on whether the received URL's query has been parsed elsewhere already. + my $url = $self->req->url->clone; + $url->query->pairs; + return $url; +} + sub _key_auth ($self, $reason, $key) { my $log = $self->app->log; @@ -197,7 +205,7 @@ my $headers = $self->req->headers; my $url = $self->req->url; - my $msg = $url->path eq '/api/v1/auth' ? ($headers->header('X-Original-URI') // $url) : $url; + my $msg = $url->path eq '/api/v1/auth' ? ($headers->header('X-Original-URI') // $url) : $self->_signing_url; my $hash = $headers->header('X-API-Hash'); my $remote_timestamp = $headers->header('X-API-Microtime'); my $our_timestamp = time; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI/Controller/Appearance.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI/Controller/Appearance.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI/Controller/Appearance.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI/Controller/Appearance.pm 2026-11-25 18:10:06.000000000 +0100 @@ -4,6 +4,8 @@ package OpenQA::WebAPI::Controller::Appearance; use Mojo::Base 'Mojolicious::Controller', -signatures; +use Time::Seconds; + sub index ($self) { $self->render; } @@ -15,10 +17,11 @@ # is_valid would only look at the last validated field return $self->reply->exception('Invalid theme settings') if $validation->has_error; - my $theme = $validation->param('theme'); - $self->session->{theme} = $theme; + # kept in long-lived cookies so the preferences outlive the login session + my %options = (max_age => ONE_YEAR, path => '/', samesite => 'Lax', secure => $self->req->is_secure); + $self->cookie(theme => $validation->param('theme'), {%options}); my $seasonal = $validation->param('seasonal_decorations'); - $self->session->{seasonal_decorations} = $seasonal if defined $seasonal; + $self->cookie(seasonal_decorations => $seasonal, {%options}) if defined $seasonal; $self->flash(info => 'Theme preferences updated'); $self->redirect_to('appearance'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI/Plugin/Helpers.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI/Plugin/Helpers.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI/Plugin/Helpers.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI/Plugin/Helpers.pm 2026-11-25 18:10:06.000000000 +0100 @@ -20,6 +20,9 @@ use List::Util qw(any min); use Feature::Compat::Try; +my %THEME_SETTINGS = (light => 1, dark => 1, detect => 1); +my %SEASONAL_DECORATION_SETTINGS = (auto => 1, on => 1, off => 1); + sub register ($self, $app, $config) { $app->helper(label_from_const => sub ($c, $val) { ucfirst $val =~ tr/_/ /r }); $app->helper( @@ -80,8 +83,12 @@ $app->helper(current_job_group => \&_current_job_group); $app->helper(current_job => sub ($c) { $c->stash('job') }); - $app->helper(current_theme => sub ($c) { $c->session->{theme} || 'light' }); - $app->helper(seasonal_decorations => sub ($c) { $c->session->{seasonal_decorations} || 'auto' }); + # the cookies are not signed, so only accept known values + $app->helper(current_theme => sub ($c) { _appearance_cookie($c, theme => \%THEME_SETTINGS, 'light') }); + $app->helper( + seasonal_decorations => sub ($c) { + _appearance_cookie($c, seasonal_decorations => \%SEASONAL_DECORATION_SETTINGS, 'auto'); + }); $app->helper(is_seasonal_period => sub ($c = undef) { (localtime)[4] == 9 }); $app->helper( seasonal_decorations_enabled => sub ($c) { @@ -303,6 +310,11 @@ return sprintf '%02d:%02d minutes', $timedate->minutes(), $timedate->seconds(); } +sub _appearance_cookie ($c, $name, $allowed, $default) { + my $value = $c->cookie($name) // ''; + return $allowed->{$value} ? $value : $default; +} + sub _current_job_group ($c) { my $job = $c->stash('job') or return undef; my $distri = $c->stash('distri'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI/Plugin/REST.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI/Plugin/REST.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI/Plugin/REST.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI/Plugin/REST.pm 2026-11-25 18:10:06.000000000 +0100 @@ -21,23 +21,28 @@ $app->helper(link_post => sub ($c, @args) { $c->action_link('post', @args) }); # Map deprecated "format" parameter to "_format" for content negotiation - # and allow "_method" parameter to override request method + # and allow "_method" parameter to override request method. Only the merged + # parameter view is rewritten, not the request URL: the URL is the basis of + # the API signature verification (see OpenQA::Shared::Controller::Auth::_key_auth). $app->hook( before_dispatch => sub ($c) { my $req = $c->req; - for my $params ($req->query_params, $req->body_params) { - my $formats = $params->every_param('format'); - next unless @$formats; - $params->remove('format'); - unless (@{$params->every_param('_format')}) { - $params->append(_format => $_) for @$formats; - } - } - # Clear cached merged params in Mojo::Message::Request so param() re-reads updated sources - delete $req->{params}; + # Merge like Mojo::Message::Request::params: body parameters first, query parameters last + $req->{params} = _with_mapped_format($req->body_params)->append(_with_mapped_format($req->query_params)); return unless my $method = $req->param('_method'); $req->method($method); }); } +sub _with_mapped_format ($params) { + my $mapped = $params->clone; + my $formats = $mapped->every_param('format'); + return $mapped unless @$formats; + $mapped->remove('format'); + unless (@{$mapped->every_param('_format')}) { + $mapped->append(_format => $_) for @$formats; + } + return $mapped; +} + 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI.pm new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI.pm --- old/openQA-5.1795520239.e4d21551/lib/OpenQA/WebAPI.pm 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/lib/OpenQA/WebAPI.pm 2026-11-25 18:10:06.000000000 +0100 @@ -131,8 +131,8 @@ $apik_auth->post('/')->to('api_key#create'); $apik_auth->delete('/:apikeyid')->name('api_key')->to('api_key#destroy'); - $logged_in->get('/appearance')->to('appearance#index')->name('appearance'); - $logged_in->post('/appearance')->to('appearance#save'); + $r->get('/appearance')->to('appearance#index')->name('appearance'); + $r->post('/appearance')->to('appearance#save'); $r->get('/search')->name('search')->to(template => 'search/search'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/t/40-script_openqa-clone-custom-git-refspec.t new/openQA-5.1795626606.295f3489/t/40-script_openqa-clone-custom-git-refspec.t --- old/openQA-5.1795520239.e4d21551/t/40-script_openqa-clone-custom-git-refspec.t 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/t/40-script_openqa-clone-custom-git-refspec.t 2026-11-25 18:10:06.000000000 +0100 @@ -10,10 +10,15 @@ use Test::Output; use OpenQA::Test::TimeLimit '20'; use OpenQA::Test::Utils qw(run_cmd test_cmd); - +use File::Which; # prevent all network access to stay local -my $cmd = 'unshare -r -n script/openqa-clone-custom-git-refspec'; +my $landrun = which('landrun'); +my $limit_cmd + = $landrun # use landrun if available as we cannot run unshare when the env is already sandboxed via landrun + ? "'$landrun' --unrestricted-filesystem --env curl_github --env curl_openqa --env dry_run --env FOO_BAR --env repo_name --env pr --env host --env job --env testsuite --env needles_dir --env productdir --" + : 'unshare -r -n'; +my $cmd = "$limit_cmd script/openqa-clone-custom-git-refspec"; sub run_once (@args) { run_cmd($cmd, @args) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/t/42-screenshots.t new/openQA-5.1795626606.295f3489/t/42-screenshots.t --- old/openQA-5.1795520239.e4d21551/t/42-screenshots.t 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/t/42-screenshots.t 2026-11-25 18:10:06.000000000 +0100 @@ -195,6 +195,24 @@ ok -d (my $result_dir = path($job->create_result_dir)), 'result directory created'; $result_dir->child('foo')->spew('-----'); + + subtest 'dry run keeps results and screenshot links' => sub { + my ($dry_deleted_results, $dry_deleted_screenshots); + combined_like { + ($dry_deleted_results, $dry_deleted_screenshots) = $job->delete_results(1); + } + qr/would delete .*\/00099982-delete-results\/foo/, 'deletion would have happened'; + is $dry_deleted_results, 5, 'size of results a dry run would delete returned'; + is $dry_deleted_screenshots, 2 * (2 + 3), 'size of screenshots a dry run would delete returned'; + is $screenshot_links->search({job_id => $job->id})->count, 3, 'screenshot links kept'; + ok -e path($imagesdir, $_), "screenshot $_ kept" for @fake_screenshots; + ok -e path($thumsdir, $_), "screenshot thumbnail $_ kept" for @fake_screenshots; + ok -e $result_dir, 'result dir kept'; + $job->discard_changes; + is $job->logs_present, 1, 'logs still considered present'; + is $job->result_size, 1000, 'result size unchanged'; + }; + my ($deleted_results, $deleted_screenshots) = $job->delete_results; is $deleted_results, 5, 'size of deleted results returned'; is $deleted_screenshots, 2 * (2 + 3), 'size of deleted screenshots returned'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/t/api/03-auth.t new/openQA-5.1795626606.295f3489/t/api/03-auth.t --- old/openQA-5.1795520239.e4d21551/t/api/03-auth.t 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/t/api/03-auth.t 2026-11-25 18:10:06.000000000 +0100 @@ -124,6 +124,23 @@ $t->put_ok('/api/v1/operator_plugin')->status_is(200)->content_is('API operator plugin works!'); }; +subtest 'signed requests with format in query' => sub { + $t->ua->apikey('ARTHURKEY01'); + $t->ua->apisecret('EXCALIBUR'); + $t->put_ok('/api/v1/operator_plugin?format=json') + ->status_is(200, 'signature covers the query as sent by the client'); + + $t->ua->once( + start => sub ($ua, $tx) { + my $url = $tx->req->url->clone; + $url->query->remove('format')->append(_format => 'json'); + my $timestamp = $tx->req->headers->header('X-API-Microtime'); + $tx->req->headers->header( + 'X-API-Hash' => hmac_sha1_sum(OpenQA::UserAgent::_path_query($url) . $timestamp, $ua->apisecret)); + }); + $t->put_ok('/api/v1/operator_plugin?format=json')->status_is(403, 'signature over the rewritten query is rejected'); +}; + subtest 'wrong api key - expired' => sub { $t->ua->apikey('EXPIREDKEY01'); $t->ua->apisecret('WHOCARESAFTERALL'); @@ -324,6 +341,23 @@ $hash = hmac_sha1_sum($c->req->url->to_string . $microtime, 'EXCALIBUR'); $c->req->headers->header('X-API-Hash' => $hash); ok $c->check, 'API key authentication succeeds with valid HMAC and timestamp'; + + my $check = sub ($hash) { + my $c = OpenQA::Shared::Controller::Auth->new(app => $t->app); + my $tx = Mojo::Transaction::HTTP->new; + $c->tx($tx); + $c->req->url->base(Mojo::URL->new('http://localhost')); + $c->req->url->parse('/api/v1/jobs?comment=via%20restart'); + $c->req->headers->host('localhost'); + $c->req->headers->header('X-API-Key' => 'ARTHURKEY01'); + $c->req->headers->header('X-API-Microtime' => $microtime); + $c->req->headers->header('X-API-Hash' => $hash); + return $c->check; + }; + ok !$check->(hmac_sha1_sum('/api/v1/jobs?comment=via%20restart' . $microtime, 'EXCALIBUR')), + 'API key authentication fails for a query signed with its raw percentage encoding'; + ok $check->(hmac_sha1_sum('/api/v1/jobs?comment=via+restart' . $microtime, 'EXCALIBUR')), + 'API key authentication succeeds for a query signed as the client re-serializes it'; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/t/config.t new/openQA-5.1795626606.295f3489/t/config.t --- old/openQA-5.1795520239.e4d21551/t/config.t 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/t/config.t 2026-11-25 18:10:06.000000000 +0100 @@ -7,7 +7,7 @@ use lib "$FindBin::Bin/lib", "$FindBin::Bin/../external/os-autoinst-common/lib"; use Test::Warnings ':report_warnings'; -use Test::Output qw(combined_like stderr_like); +use Test::Output qw(combined_like combined_unlike stderr_like); use Test::MockModule; use Test::MockObject; use Mojolicious; @@ -368,6 +368,33 @@ is_deeply lookup_config_files(@args), \@expected, 'drop-in in overridden dir hides all other config'; }; +subtest 'Inaccessible config dir' => sub { + my $t_dir = tempdir; + my $config_mock = Test::MockModule->new('OpenQA::Config'); + $config_mock->redefine(_config_dirs => [["$t_dir/inaccessible", "$t_dir/valid"]]); + + my $file_mock = Test::MockModule->new('Mojo::File'); + my $orig_list = $file_mock->original('list'); + $file_mock->redefine( + list => sub ($self, @args) { + die "fake permission denied\n" if $self =~ m{/inaccessible}; + return $orig_list->($self, @args); + }); + + my @expected = ("$t_dir/valid/openqa.ini"); + $t_dir->child('valid')->make_path->child('openqa.ini')->touch; + + combined_like { + is_deeply lookup_config_files(undef, 'openqa.ini'), \@expected, 'found config despite inaccessible directory'; + } + qr/Unable to add config files under ".*inaccessible": fake permission denied/, 'warning logged when not silent'; + + combined_unlike { + is_deeply lookup_config_files(undef, 'openqa.ini', 1), \@expected, 'found config silently'; + } + qr/Unable to add config files/, 'no warning logged when silent'; +}; + subtest 'check throttling configuration validation and application' => sub { my $app = OpenQA::App->singleton(); my $config = $app->config; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/t/ui/04-appearance.t new/openQA-5.1795626606.295f3489/t/ui/04-appearance.t --- old/openQA-5.1795520239.e4d21551/t/ui/04-appearance.t 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/t/ui/04-appearance.t 2026-11-25 18:10:06.000000000 +0100 @@ -7,6 +7,7 @@ use FindBin; use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../external/os-autoinst-common/lib"; use Test::Mojo; +use Time::Seconds; use Test::Warnings ':report_warnings'; use OpenQA::Test::TimeLimit '8'; use OpenQA::Test::Case; @@ -33,14 +34,21 @@ } } -subtest 'No login, no themes' => sub { - $t->get_ok('/appearance')->status_is(302); +subtest 'Appearance can be changed without login' => sub { + $t->ua->max_redirects(5); + check_form('light', 'auto'); + check_page('light', $season, 0); + $t->post_ok('/appearance' => form => {theme => 'dark', seasonal_decorations => 'on'})->status_is(200); + check_form('dark', 'on'); + check_page('dark', 'true', 1); + $t->get_ok('/')->element_exists('#user-action a[href$="/login"]') + ->element_exists('nav a.nav-link[href$="/appearance"]'); + $t->reset_session; }; subtest 'Login as Percival' => sub { $t->get_ok('/tests'); $test_case->login($t, 'percival'); - $t->ua->max_redirects(5); }; subtest 'Default is light theme with seasonal decorations enabled during October' => sub { @@ -97,4 +105,28 @@ check_form('dark', 'on'); }; +sub cookie_for ($name) { + (grep { $_->name eq $name } @{$t->ua->cookie_jar->all})[0]; +} + +subtest 'Preferences are stored in cookies that outlive the login session' => sub { + my $max_age = cookie_for('theme')->max_age; + cmp_ok $max_age, '>', 2 * ONE_DAY, 'theme cookie outlives the login session'; + is cookie_for('seasonal_decorations')->max_age, $max_age, 'seasonal_decorations cookie has the same lifetime'; + my $jar = $t->ua->cookie_jar; + my @appearance = grep { $_->name =~ /^(?:theme|seasonal_decorations)$/ } @{$jar->all}; + $jar->empty; + $jar->add($_) for @appearance; + ok !cookie_for('mojolicious'), 'session cookie is gone'; + check_page('dark', 'true', 1); +}; + +subtest 'Invalid cookie values fall back to the defaults' => sub { + $t->ua->cookie_jar->empty; + $t->ua->cookie_jar->add( + Mojo::Cookie::Response->new(name => $_, value => 'bogus', domain => 'localhost', path => '/')) + for qw(theme seasonal_decorations); + check_page('light', $season, 0); +}; + done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/templates/webapi/layouts/navbar.html.ep new/openQA-5.1795626606.295f3489/templates/webapi/layouts/navbar.html.ep --- old/openQA-5.1795520239.e4d21551/templates/webapi/layouts/navbar.html.ep 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/templates/webapi/layouts/navbar.html.ep 2026-11-25 18:10:06.000000000 +0100 @@ -108,6 +108,9 @@ </li> % } else { + <li class='nav-item'> + %= link_to('Appearance' => url_for('appearance') => class => 'nav-link') + </li> <li class='nav-item' id="user-action"> %= link_to('Login' => url_for('login') => class => 'nav-link') </li> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-5.1795520239.e4d21551/tools/ci/autoinst.sha new/openQA-5.1795626606.295f3489/tools/ci/autoinst.sha --- old/openQA-5.1795520239.e4d21551/tools/ci/autoinst.sha 2026-11-24 12:37:19.000000000 +0100 +++ new/openQA-5.1795626606.295f3489/tools/ci/autoinst.sha 2026-11-25 18:10:06.000000000 +0100 @@ -1 +1 @@ -5.044000-c9da151cd0f3061f093ca45a28fb03fcd0872319 \ No newline at end of file +5.044000-d4232ccbdbf1acdda2578afc80d1effb074ca1a7 \ No newline at end of file ++++++ openQA.obsinfo ++++++ --- /var/tmp/diff_new_pack.NieyCu/_old 2026-11-26 15:55:20.082655269 +0100 +++ /var/tmp/diff_new_pack.NieyCu/_new 2026-11-26 15:55:20.087655480 +0100 @@ -1,5 +1,5 @@ name: openQA -version: 5.1795520239.e4d21551 -mtime: 1795520239 -commit: e4d215515ac4d69c28aab41f04b90cb1402e6c86 +version: 5.1795626606.295f3489 +mtime: 1795626606 +commit: 295f34894de503642cf56a5cb528c1192c10cc90
