[Bug 43505] New: Use Koha::QA from the test suite
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 Bug ID: 43505 Summary: Use Koha::QA from the test suite Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Test Suite Assignee: jonathan.druart@gmail.com Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42152, 43503, 43480 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42152 [Bug 42152] xt/author/valid-templates.t should use Koha::Devel::Files to list the files to process https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43480 [Bug 43480] Remove BEGIN block from C4::Tags https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43503 [Bug 43503] xt/author/podcorrectness.t no longer needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205453 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205453&action=edit Bug 43505: Add Koha::QA as a cpanfile dependency Koha::QA is the new shared QA library (PerlCritic, Tidy, Spelling, Security checks, etc.) used by misc/devel/tidy.pl, t/00-testcritic.t, and several xt tests. It replaces the duplicated implementations of the same checks that used to live directly in Koha core, qa-test-tools, and koha-plugin-certification, and is now published on CPAN as Koha-QA 0.1.0: https://metacpan.org/dist/Koha-QA Test plan: 1. Run `cpanm --installdeps .` (or `perl Makefile.PL && make`) and confirm Koha::QA installs successfully from CPAN. 2. Run t/00-testcritic.t and the xt/ tests that use Koha::QA::* modules (xt/author/codespell.t, xt/author/pod_checker.t, xt/find-csrf-issues.t, xt/find-misplaced-executables.t, xt/find-missing-filters.t, xt/find-missing-nonce.t, xt/pl_valid.t, xt/use-test-no-warnings.t) and confirm they still pass. QA: Adding Koha::QA in cpanfile does not make it available in packaged installs. See the following patch skipping it in debian/list-deps. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205454 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205454&action=edit Bug 43505: Skip Koha::QA in debian/list-deps auto-generation Koha::QA is not (yet?) packaged, and apt won't find it and will crash. It's only needed for dev installations anyway. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205455 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205455&action=edit Bug 43505: Koha::QA - Security::TemplateFilters Replace t::lib::QA::TemplateFilters with Koha::QA::Security::TemplateFilters in misc/devel/add_missing_filters.pl and xt/find-missing-filters.t. The logic is now in Koha::QA, with its tests. Test plan: 1. `prove xt/find-missing-filters.t` => It still passes! 2. Run misc/devel/add_missing_filters.pl on a .tt file with a missing filter => It still fixes it! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205456 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205456&action=edit Bug 43505: Koha::QA - Security::CSRF Replace the `check_csrf_in_forms()` sub in xt/find-missing-csrf.t with Koha::QA::Security::CSRF. Test plan: `prove xt/find-missing-csrf.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205457 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205457&action=edit Bug 43505: Koha::QA - Security::Nonce Replace the `catch_missing_nonce()` sub in xt/find-missing-nonce.t with Koha::QA::Security::Nonce. Test plan: `prove xt/find-missing-nonce.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #6 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205458 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205458&action=edit Bug 43505: Koha::QA - Spelling Replace the `codespell` call in xt/author/codespell.t with Koha::QA::Spelling. Diagnostic output changes slightly: each line now reads Before: "file:line:Spelling error: word ==> suggestion" After: "file:line: word ==> suggestion" (codespell's own raw format). Test plan: `prove xt/author/codespell.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205459 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205459&action=edit Bug 43505: Koha::QA - PerlCritic Replace Test::Perl::Critic in t/00-testcritic.t with Koha::QA::PerlCritic Test plan: `prove t/00-testcritic.t` => It still passes. QA: Behaviour change: Test::Perl::Critic was an optional dependency, the test used `plan skip_all` when it was not installed. Koha::QA::PerlCritic uses Perl::Critic and it is made mandatory. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205460 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205460&action=edit Bug 43505: Koha::QA - PerlSyntax Replace the `perl -cw` command with Koha::QA::PerlSyntax. Test plan: `prove xt/pl_valid.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #9 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205461 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205461&action=edit Bug 43505: Koha::QA - Tidy::Perl Replace the `perltidy` command in misc/devel/tidy.pl and the Test::Perltidy check in xt/perltidy.t with Koha::QA::Tidy::Perl Test plan: 1. `prove xt/perltidy.t` => It still passes! 2. perl misc/devel/tidy.pl /path/to/file => It still tidy the file the same way as before QA: We drop `libtest-perltidy-perl` from debian/control: xt/perltidy.t no longer uses Test::PerlTidy and Koha::QA uses Perl::Tidy -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205462&action=edit Bug 43505: Koha::QA - TestNoWarnings Replace the git grep oneline with Koha::QA::TestNoWarnings. Also add Koha::Devel::Files->ls_perl_test_files to list .t files from t/ and xt/ dirs Test plan: `prove xt/use-test-no-warnings.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #11 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205463 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205463&action=edit Bug 43505: Koha::QA - FilePermissions Use Koha::QA::FilePermissions from xt/find-misplaced-executables.t Also replaces File::Find with Koha::Devel::Files->ls_perl_files, and add the .sh files. Also fixes bug 42146 as a side effect. Test plan: `prove xt/find-misplaced-executables.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #12 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205464 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205464&action=edit Bug 43505: Koha::QA - PodChecker Replace Pod::Checker usage in xt/author/pod_checker.t with Koha::QA::PodChecker. Test plan: `prove xt/author/pod_checker.t` => It still passes! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205465 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205465&action=edit Bug 43505: Koha::QA - Tidy::JS Replace the direct `yarn --silent run prettier` command with Koha::QA::Tidy::JS. Test plan: 0. You will need the merge request from https://gitlab.com/koha-community/koha-testing-docker/-/work_items/562 Or build Koha::QA with `make js-deps` (see its README) 1. `perl misc/devel/tidy.pl /path/to/file.js` on a .js file and confirm it tidy the same way as before. QA: We previously ran whatever prettier available via Koha's own root-level. It now runs the prettier provided by Koha::QA (see its File::ShareDir share directory) Which is only populated by Koha::QA's `make js-deps` build step. See the koha-testing-docker and qa-test-tools patches doing that. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205466 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205466&action=edit Bug 43505: Koha::QA - Tidy::TT Test plan: Same as previous patch (Tidy::JS) but run the tidy.pl script on a .tt or .inc file. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205467 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205467&action=edit Bug 43505: Koha::QA - CSRF 'op in forms' Consolidate xt/find-missing-csrf.t (CSRF token check) and xt/find-missing-op-in-forms.t (op parameter / "cud-" prefix check) into a single test, renamed to xt/find-csrf-issues.t. Both checks are now covered by one Koha::QA::Security::CSRF checker, which reports the following possible errors: * missing_csrf_token * missing_op * and invalid_op_value Test plan: `prove xt/find-csrf-issues.t` => It still passes! => It still catches: * a missing CSRF token * a missing/invalid op parameter -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205468 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205468&action=edit Bug 43505: Fix tidy.pl - do not truncate files when a Koha::QA checker fails -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43505 --- Comment #17 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 205469 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205469&action=edit Bug 43505: Remove Test::PerlTidy -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org