Bugzilla – Attachment 172029 Details for
Bug 35655
Make it possible to switch off RabbitMQ without any warns in logs/about page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35655: Add unit tests
Bug-35655-Add-unit-tests.patch (text/plain), 2.05 KB, created by
Kyle M Hall (khall)
on 2024-09-26 19:17:45 UTC
(
hide
)
Description:
Bug 35655: Add unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-09-26 19:17:45 UTC
Size:
2.05 KB
patch
obsolete
>From fce40966d9f7d30241d54813e2b023467e69b326 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 26 Sep 2024 15:16:44 -0400 >Subject: [PATCH] Bug 35655: Add unit tests > >Add the ability to specify STOMP connection info via environment >variables and utilize those in unit tests. >--- > Koha/BackgroundJob.pm | 5 +++-- > t/db_dependent/Koha/BackgroundJob.t | 17 ++++++++++++++++- > 2 files changed, 19 insertions(+), 3 deletions(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index c21fdd2510b..99fc3bb3ddd 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -67,8 +67,9 @@ sub connect { > return undef > unless $notification_method eq 'STOMP'; > >- my $hostname = 'localhost'; >- my $port = '61613'; >+ my $hostname = $ENV{KOHA_STOMP_HOSTNAME} // 'localhost'; >+ my $port = $ENV{KOHA_STOMP_PORT} // '61613'; >+ > my $config = C4::Context->config('message_broker'); > my $credentials = { > login => 'guest', >diff --git a/t/db_dependent/Koha/BackgroundJob.t b/t/db_dependent/Koha/BackgroundJob.t >index f34b695c492..35f8fb4e7d7 100755 >--- a/t/db_dependent/Koha/BackgroundJob.t >+++ b/t/db_dependent/Koha/BackgroundJob.t >@@ -19,7 +19,7 @@ use Modern::Perl; > use utf8; > use Encode; > >-use Test::More tests => 5; >+use Test::More tests => 6; > use Test::MockModule; > use Test::Exception; > >@@ -297,3 +297,18 @@ subtest 'decoded_data() and set_encoded_data() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'decoded_data() and set_encoded_data() tests' => sub { >+ plan tests => 2; >+ >+ $ENV{KOHA_STOMP_HOSTNAME} = "not_localhost"; >+ $ENV{KOHA_STOMP_PORT} = "99999"; >+ >+ t::lib::Mocks::mock_preference('JobsNotificationMethod', 'STOMP'); >+ my $job = Koha::BackgroundJob->connect(); >+ is( $job, undef, "Return undef if unable to connect when using stomp" ); >+ >+ t::lib::Mocks::mock_preference('JobsNotificationMethod', 'polling'); >+ $job = Koha::BackgroundJob->connect(); >+ is( $job, undef, "Return undef if using polling" ); >+} >-- >2.39.5 (Apple Git-154)
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 35655
:
171412
|
171413
|
171503
|
171504
|
171505
|
171506
|
171507
|
171509
|
171510
|
171511
|
171512
|
172027
|
172028
|
172029
|
172157
|
172158
|
172159
|
172232