Bug 30345 - Koha::BackgroundJob->enqueue should set borrowernumber=undef if no userenv
Summary: Koha::BackgroundJob->enqueue should set borrowernumber=undef if no userenv
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 30172
Blocks: 27783
  Show dependency treegraph
 
Reported: 2022-03-23 18:35 UTC by Tomás Cohen Arazi
Modified: 2023-02-02 15:28 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00


Attachments
Bug 30345: Regression tests (2.04 KB, patch)
2022-03-23 18:52 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv (1.65 KB, patch)
2022-03-23 18:52 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30345: Regression tests (2.04 KB, patch)
2022-03-25 13:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv (1.60 KB, patch)
2022-03-25 13:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30345: Regression tests (2.10 KB, patch)
2022-04-01 08:09 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv (1.66 KB, patch)
2022-04-01 08:10 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 30345: Regression tests (2.15 KB, patch)
2022-04-01 12:11 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 30345: Regression tests (2.15 KB, patch)
2022-04-01 12:24 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv (1.72 KB, patch)
2022-04-01 12:24 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2022-03-23 18:35:35 UTC
It currently explodes. This is annoying in the tests.
Comment 1 Tomás Cohen Arazi 2022-03-23 18:52:45 UTC
Created attachment 132074 [details] [review]
Bug 30345: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi 2022-03-23 18:52:49 UTC
Created attachment 132075 [details] [review]
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv

This patch makes ->enqueue set undef if no userenv is provided. The CLI
scripts will usually use Koha::Script and have this set to undef as
well, but on the tests, there's usually no userenv set unless we need to
test it. And as we are adding triggers everywhere, that will schedule
background jobs, it means we would end up mocking userenv or the
->enqueue method everywhere and it will get messy.

This patch just make it set undef.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJob.t
=> FAIL: Wow, it explodes badly. Same as any test that happens to
trigger a background job enqueuing.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Great, tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi 2022-03-25 13:01:04 UTC
Created attachment 132243 [details] [review]
Bug 30345: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2022-03-25 13:01:08 UTC
Created attachment 132244 [details] [review]
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv

This patch makes ->enqueue set undef if no userenv is provided. The CLI
scripts will usually use Koha::Script and have this set to undef as
well, but on the tests, there's usually no userenv set unless we need to
test it. And as we are adding triggers everywhere, that will schedule
background jobs, it means we would end up mocking userenv or the
->enqueue method everywhere and it will get messy.

This patch just make it set undef.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJob.t
=> FAIL: Wow, it explodes badly. Same as any test that happens to
trigger a background job enqueuing.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Great, tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Arthur Suzuki 2022-04-01 08:09:59 UTC
Created attachment 132824 [details] [review]
Bug 30345: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 6 Arthur Suzuki 2022-04-01 08:10:46 UTC
Created attachment 132825 [details] [review]
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv

This patch makes ->enqueue set undef if no userenv is provided. The CLI
scripts will usually use Koha::Script and have this set to undef as
well, but on the tests, there's usually no userenv set unless we need to
test it. And as we are adding triggers everywhere, that will schedule
background jobs, it means we would end up mocking userenv or the
->enqueue method everywhere and it will get messy.

This patch just make it set undef.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJob.t
=> FAIL: Wow, it explodes badly. Same as any test that happens to
trigger a background job enqueuing.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Great, tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 7 Kyle M Hall 2022-04-01 12:11:48 UTC
Created attachment 132851 [details] [review]
Bug 30345: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Kyle M Hall 2022-04-01 12:24:33 UTC
Created attachment 132852 [details] [review]
Bug 30345: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Kyle M Hall 2022-04-01 12:24:44 UTC
Created attachment 132853 [details] [review]
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv

This patch makes ->enqueue set undef if no userenv is provided. The CLI
scripts will usually use Koha::Script and have this set to undef as
well, but on the tests, there's usually no userenv set unless we need to
test it. And as we are adding triggers everywhere, that will schedule
background jobs, it means we would end up mocking userenv or the
->enqueue method everywhere and it will get messy.

This patch just make it set undef.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJob.t
=> FAIL: Wow, it explodes badly. Same as any test that happens to
trigger a background job enqueuing.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Great, tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>