[Bug 18445] New: Tests in t stumble over Auth's BEGIN block

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] New: Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

            Bug ID: 18445
           Summary: Tests in t stumble over Auth's BEGIN block
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Test Suite
          Assignee: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

We should be able to run the tests in t without the database.
But if some module loads Auth.pm via C4/Serials or Koha/Virtualshelf directly
or indirectly, this will trigger execution of Auth's BEGIN block. This block
contains three calls for systempreferences (one from Auth_with_cas). Note that
loading Biblio.pm also starts a chain going to Auth.pm.

This report changes two use C4::Auth statements into requires. This will
prevent or postpone execution of this code. Note also that this will resolve a
few failing tests like (Matcher.t and Prices.t) where the schema mock actually
was too late and the database was accessed instead of defined fixtures.

Along the way we fix a few minor issues in t where database access should be
eliminated.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

Marcel de Rooy <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|[hidden email]    |[hidden email]
             Status|NEW                         |ASSIGNED

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

--- Comment #1 from Marcel de Rooy <[hidden email]> ---
Created attachment 62290
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=62290&action=edit
Bug 18445: Replace two use C4::Auth statements

Both Serials.pm and Virtualshelf.pm only need haspermission in a specific
sub. Since loading the module at compile-time triggers early execution of
the BEGIN block, this results in database access in the tests that are
assumed to be database independent.

At the same time we are resolving test failures in Matcher.t and Prices.t
because the schema mock is too late.

Test plan:
[1] Do not yet apply this patch. Backup your database.
[2] Drop the database and create a new empty one.
[3] Run the tests in t. Look at Matcher.t and Prices.t too.
    You will see quite some occurrences of:
    DBD::mysql::st execute failed: Table 'koha_master.systempreferences'
doesn't exist [for Statement "SELECT `me`.`variable`, `me`.`value`,
`me`.`options`, `me`.`explanation`, `me`.`type` FROM `systempreferences` `me`
WHERE ( `me`.`variable` = ? )" with ParamValues: 0='casauthentication'] at
/usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

[4] Apply this patch.
[5] Run the tests in t again. Check the results of Matcher.t and Prices.t.
[6] Restore your database.
[7] Run t/db_dependent/Serials_2.t to trigger the change in Serials.
[8] Run t/db_dependent/Virtualshelves.t to test Koha/Virtualshelf.

Signed-off-by: Marcel de Rooy <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

Marcel de Rooy <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugs.koha-community
                   |                            |.org/bugzilla3/show_bug.cgi
                   |                            |?id=14642

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

--- Comment #2 from Marcel de Rooy <[hidden email]> ---
Created attachment 62292
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=62292&action=edit
Bug 18445: Fix Log.t by mocking HoldsLog

The HoldsLog preference was added later on (bug 14642).
It should be mocked too in this test.

Test plan:
Run t/Log.t (with an empty Koha database).

Signed-off-by: Marcel de Rooy <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

--- Comment #3 from Marcel de Rooy <[hidden email]> ---
Created attachment 62293
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=62293&action=edit
Bug 18445: Resolve a warning in SMS.t by mocking config

Resolves the warning:
  "Use of uninitialized value in subroutine entry at C4/SMS.pm line 98"
when sms_send_config does not exist in your koha-conf.xml.

Test plan:
Run SMS.t without and with this patch.

Signed-off-by: Marcel de Rooy <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

Marcel de Rooy <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |Needs Signoff

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

Marcel de Rooy <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |18420


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18420
[Bug 18420] Some tests fail without patron category 'S'
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

--- Comment #4 from Marcel de Rooy <[hidden email]> ---
Created attachment 62299
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=62299&action=edit
Bug 18445: Remove Test::DBIx::Class from XSLT.t

Removing the tests around get_xslt_sysprefs from XSLT.t.
It makes no sense to test sysprefs values in a test that should be
database agnostic.

Will add t/db_dependent/XSLT.t to rescue the ideas behind these lines.

Test plan:
Run t/XSLT.t
Run t/db_dependent/XSLT.t

Signed-off-by: Marcel de Rooy <[hidden email]>

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

Jonathan Druart <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]-c
                   |                            |ommunity.org
           See Also|                            |https://bugs.koha-community
                   |                            |.org/bugzilla3/show_bug.cgi
                   |                            |?id=18226

--- Comment #5 from Jonathan Druart <[hidden email]> ---
Marcel, did you see bug 18226 and related?
I don't think we should replace the use with require to make the tests pass.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

--- Comment #6 from Marcel de Rooy <[hidden email]> ---
(In reply to Jonathan Druart from comment #5)
> Marcel, did you see bug 18226 and related?
> I don't think we should replace the use with require to make the tests pass.

Ah, no not yet. Will be looking.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445

Marcel de Rooy <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Signoff               |BLOCKED

--- Comment #7 from Marcel de Rooy <[hidden email]> ---
Returning here later

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 18445] Tests in t stumble over Auth's BEGIN block

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18445
Bug 18445 depends on bug 18420, which changed state.

Bug 18420 Summary: Some tests fail without patron category 'S'
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18420

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Pushed to Master            |RESOLVED
         Resolution|---                         |FIXED

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Loading...