Bug 27421: (QA follow-up) Polishing the backgroundjob modules
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 19 Aug 2022 07:54:55 +0000 (07:54 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 19 Sep 2022 18:14:59 +0000 (15:14 -0300)
commit5b6d1e99a24f7834d4c3e8469a729a56bd69cf10
treedb8e1507c58ac0cfffd0d5816b0e51177d278a34
parentbdb107bcec6d87649d6c38ac8bee960a321c9ab0
Bug 27421: (QA follow-up) Polishing the backgroundjob modules

StageMARCForImport:
- Rollback in catch
- Setting progress, size or status after BatchStageMarcRecords
  in both try and catch block

ImportCommitBatch:
- Move setting size back to enqueue moment
- Rollback in catch
- Setting progress, size or status after BatchStageMarcRecords
  in both try and catch block

ImportRevertBatch:
- Move setting size back to enqueue moment
- Adding transaction/rollback to module since import routine
  does not support it. Could be moved later.
- Setting progress, size or status after BatchStageMarcRecords
  in both try and catch block

Test plan:
Run t/db_dependent/Koha/BackgroundJobs/StageMARCForImport.t
Test staging file
Bonus: Put a die statement in BatchStageMarcRecords.

Test importing batch
Bonus: Include some records with an invalid library code; this will
trigger an FK exception. (Reduce the progress from 50 to 1. If your
first record would be fine, check if it is NOT imported when the job
fails.)

Test reverting batch.
Bonus: Put a die in BatchRevertRecords.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/BackgroundJob/MARCImportCommitBatch.pm
Koha/BackgroundJob/MARCImportRevertBatch.pm
Koha/BackgroundJob/StageMARCForImport.pm