Description
Tomás Cohen Arazi (tcohen)
2022-03-23 18:35:35 UTC
Created attachment 132074 [details] [review] Bug 30345: Regression tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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> Created attachment 132243 [details] [review] Bug 30345: Regression tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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> 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> 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> 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> 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> 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> |