Bugzilla – Attachment 182573 Details for
Bug 34070
background_jobs_worker.pl floods logs when it gets error frames
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34070: Add tests
Bug-34070-Add-tests.patch (text/plain), 2.71 KB, created by
Marcel de Rooy
on 2025-05-19 07:24:15 UTC
(
hide
)
Description:
Bug 34070: Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2025-05-19 07:24:15 UTC
Size:
2.71 KB
patch
obsolete
>From c877d87fca1b0aaf6bfb8aa628d0aa237d231d1f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 10 Mar 2025 11:22:23 +0100 >Subject: [PATCH] Bug 34070: Add tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Koha/BackgroundJob.t | 39 +++++++++++++++++++++-------- > 1 file changed, 29 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/Koha/BackgroundJob.t b/t/db_dependent/Koha/BackgroundJob.t >index 3e4e0354e9..035823d6f7 100755 >--- a/t/db_dependent/Koha/BackgroundJob.t >+++ b/t/db_dependent/Koha/BackgroundJob.t >@@ -303,17 +303,36 @@ subtest 'decoded_data() and set_encoded_data() tests' => sub { > $schema->storage->txn_rollback; > }; > >-subtest 'decoded_data() and set_encoded_data() tests' => sub { >- plan tests => 3; >+subtest 'connect' => sub { >+ plan tests => 2; >+ >+ subtest 'JobsNotificationMethod' => sub { >+ plan tests => 3; >+ t::lib::Mocks::mock_config( 'message_broker', { hostname => 'not_localhost', port => '99999' } ); >+ >+ t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'STOMP' ); >+ my $job; >+ warning_like { $job = Koha::BackgroundJob->connect() } qr{Cannot connect to broker}; >+ is( $job, undef, "Return undef if unable to connect when using stomp" ); > >- t::lib::Mocks::mock_config( 'message_broker', { hostname => 'not_localhost', port => '99999' } ); >+ t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'polling' ); >+ $job = Koha::BackgroundJob->connect(); >+ is( $job, undef, "Return undef if using polling" ); >+ }; >+ >+ subtest 'wrong credentials' => sub { >+ plan tests => 2; >+ t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'STOMP' ); > >- t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'STOMP' ); >- my $job; >- warning_like { $job = Koha::BackgroundJob->connect() } qr{Cannot connect to broker}; >- is( $job, undef, "Return undef if unable to connect when using stomp" ); >+ t::lib::Mocks::mock_config( >+ 'message_broker', >+ { hostname => 'localhost', port => '61613', username => 'guest', password => 'wrong_password' } >+ ); > >- t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'polling' ); >- $job = Koha::BackgroundJob->connect(); >- is( $job, undef, "Return undef if using polling" ); >+ my $job; >+ warning_is { $job = Koha::BackgroundJob->connect() } >+ q{Cannot connect to broker (Access refused for user 'guest')}; >+ is( $job, undef, "Return undef if unable to connect when using stomp" ); >+ >+ }; > }; >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34070
:
178068
|
179024
|
179025
|
179094
|
179095
|
179214
|
179215
|
179216
|
179217
|
179218
|
182570
|
182571
|
182572
| 182573 |
182574