1. KOHA_IMAGE=main-bookworm ktd up 2. prove t/db_dependent/OAI/Server.t 3. pass 4. KOHA_IMAGE=main-trixie ktd up 5. prove t/db_dependent/OAI/Server.t # got : 'http://localhost/' # expect : 'http://localhost' Severity = major because it makes the CI fail and hides issues even if not as much as Bug 40680.
The tests fail because the returned structures differ. In particular the difference is a trailing slash in the `request: http://localhost` portion of the response. Debian's updated `CGI` module is the culprit: To reproduce: 1. Run: $ KOHA_IMAGE=main-bookworm ktd --proxy --name bookworm up -d $ ktd --name bookworm --wait-ready 120 $ ktd --name bookworm --shell --run "perl -MCGI -e 'print \"CGI \$CGI::VERSION: \", CGI->new->self_url, \"\n\"'" && ktd --name bookworm down => SUCCESS: Prints ``` CGI 4.55: http://localhost ``` 2. Run: $ KOHA_IMAGE=main-trixie ktd --proxy --name bookworm up -d $ ktd --name trixie --wait-ready 120 $ ktd --name trixie --shell --run "perl -MCGI -e 'print \"CGI \$CGI::VERSION: \", CGI->new->self_url, \"\n\"'" && ktd --name trixie down => FAIL: Prints ``` CGI 4.68: http://localhost/ ```
Created attachment 190161 [details] [review] Bug 40989: Fix OAI-PMH tests for CGI.pm 4.68+ CGI.pm 4.68 (shipped with Debian 13/Trixie) changed the behavior of self_url() to include a trailing slash when there's no path component. This causes OAI-PMH tests to fail as they expect URLs without trailing slashes. This patch strips the trailing slash from both the requestURL field in OAI responses and the baseURL field in Identify responses to maintain compatibility across CGI.pm versions. Test plan: 1. Start a 'trixie' KTD: $ KOHA_IMAGE=main-trixie ktd --proxy --name trixie up -d $ ktd --name trixie --wait-ready 120 2. Run the tests: $ ktd --name trixie --shell k$ prove t/db_dependent/OAI/Server.t => FAIL: Tests fail! 3. Apply this patch 5. Repeat 2 6. Repeat 1-2 with a 'bookworm' image => SUCCESS: Tests pass too! 7. Sign off :-D
Created attachment 190189 [details] [review] Bug 40989: Fix OAI-PMH tests for CGI.pm 4.68+ CGI.pm 4.68 (shipped with Debian 13/Trixie) changed the behavior of self_url() to include a trailing slash when there's no path component. This causes OAI-PMH tests to fail as they expect URLs without trailing slashes. This patch strips the trailing slash from both the requestURL field in OAI responses and the baseURL field in Identify responses to maintain compatibility across CGI.pm versions. Test plan: 1. Start a 'trixie' KTD: $ KOHA_IMAGE=main-trixie ktd --proxy --name trixie up -d $ ktd --name trixie --wait-ready 120 2. Run the tests: $ ktd --name trixie --shell k$ prove t/db_dependent/OAI/Server.t => FAIL: Tests fail! 3. Apply this patch 5. Repeat 2 6. Repeat 1-2 with a 'bookworm' image => SUCCESS: Tests pass too! 7. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Leaving a note for QA review: * The CGI->self_url() change can be considered an enhancement on CGI. My patch makes sure it doesn't work the way upstream does, but makes it 'not change behavior'. My call was to do it like this because... * The tests are very large and a refactoring *could* be a pain to support both cases (been told I change too many lines in tests when providing 'a one line fix'). * I don't think that trailing slash is relevant at all in any case
> refactoring *could* be a pain to support both cases +1 and if anything to refactor, it would be accommodate the new self_url() output, not both cases. If we can away without wider changes, let's go with that. -- Not related to fixing the tests but still to the change of self_url(), there are other occurrences of self_url() that on recent OSes I guess should lead to URLs with a double / in the middle. That shouldn't be a worry right? Unless we have a specific case that could be a concern. For good measure, I've emailed Matts to know if they think of something when knowing about that self_url() change. Otherwise, test plan works and code looks good so I think I'll pass QA not later than Monday unless some info comes up.
Created attachment 190467 [details] [review] Bug 40989: Fix OAI-PMH tests for CGI.pm 4.68+ CGI.pm 4.68 (shipped with Debian 13/Trixie) changed the behavior of self_url() to include a trailing slash when there's no path component. This causes OAI-PMH tests to fail as they expect URLs without trailing slashes. This patch strips the trailing slash from both the requestURL field in OAI responses and the baseURL field in Identify responses to maintain compatibility across CGI.pm versions. Test plan: 1. Start a 'trixie' KTD: $ KOHA_IMAGE=main-trixie ktd --proxy --name trixie up -d $ ktd --name trixie --wait-ready 120 2. Run the tests: $ ktd --name trixie --shell k$ prove t/db_dependent/OAI/Server.t => FAIL: Tests fail! 3. Apply this patch 5. Repeat 2 6. Repeat 1-2 with a 'bookworm' image => SUCCESS: Tests pass too! 7. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Works, makes sense, QA script happy, code looks good, passing QA :)
Thanks Matts for the quick glance and confirming there seems to be nothing additional to worry about.
Nice work everyone! Pushed to main for 26.05