Bug 32375

Summary: 22.05.07 failing t/AuthoritiesMarc_MARC21.t
Product: Koha Reporter: Wainui Witika-Park <wainuiwitikapark>
Component: Test SuiteAssignee: Chris Cormack <chris>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P2 CC: arthur.suzuki, danyonsewell, david, lucas, victor, wainuiwitikapark
Version: 22.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.11, 21.11.19
Circulation function:
Attachments: bug 32375: moving t/AuthoritiesMarc_MARC21.t to t/db_dependent
Bug 32375: Move t/AuthoritiesMarc_MARC21.t to t/db_dependent
Bug 32375: Move t/AuthoritiesMarc_MARC21.t to t/db_dependent

Description Wainui Witika-Park 2022-11-30 03:57:20 UTC
t/AuthoritiesMarc_MARC21.t is failing on 22.05.07

Please see the output below:

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/AuthoritiesMarc_MARC21.t  
t/AuthoritiesMarc_MARC21.t .. 1/5     # No tests run!
t/AuthoritiesMarc_MARC21.t .. 5/5 
#   Failed test 'No tests run for subtest "FindDuplicateAuthority tests"'
#   at t/AuthoritiesMarc_MARC21.t line 62.
DBIx::Class::Storage::DBI::catch {...} (): DBI Connection failed: DBI connect('database=koha_kohadev;host=localhost;port=3306','koha_kohadev',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /home/vagrant/kohaclone/Koha/Database.pm line 91. at /home/vagrant/kohaclone/Koha/Database.pm line 139
# Looks like your test exited with 255 just after 5.
t/AuthoritiesMarc_MARC21.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/5 subtests 

Test Summary Report
-------------------
t/AuthoritiesMarc_MARC21.t (Wstat: 65280 Tests: 5 Failed: 1)
  Failed test:  5
  Non-zero exit status: 255
Files=1, Tests=5,  2 wallclock secs ( 0.02 usr  0.01 sys +  1.57 cusr  0.17 csys =  1.77 CPU)
Result: FAIL
Comment 1 Chris Cormack 2022-11-30 04:01:15 UTC
It appears the tests added in bug 31023 have made this test db dependent now so it looks like it needs to be moved to t/db_dependent
Comment 2 Chris Cormack 2022-11-30 21:33:03 UTC
I dont think the tests can be written to work without a db, (and still test something) so shifting this file to t/db_dependent seems the only way forward. We will send a patch
Comment 3 Danyon Sewell 2022-11-30 23:59:28 UTC
Created attachment 144370 [details] [review]
bug 32375: moving t/AuthoritiesMarc_MARC21.t to t/db_dependent

t/AuthoritiesMarc_MARC21.t is now db dependent so it needs to be in
t/db_dependent to pass the tests

Sponsored-by: Catalyst IT
Comment 4 Lucas Gass (lukeg) 2022-12-01 22:08:02 UTC
Hey all,

I am having trouble making t/AuthoritiesMarc_MARC21.t fail on my 22.05.x branch. 

Maybe I missing a specific configuration that will make this fail?
Comment 5 Wainui Witika-Park 2022-12-01 22:21:06 UTC
(In reply to Lucas Gass from comment #4)
> Hey all,
> 
> I am having trouble making t/AuthoritiesMarc_MARC21.t fail on my 22.05.x
> branch. 
> 
> Maybe I missing a specific configuration that will make this fail?

Hi Lucas,

Can you start mysql and see if it fails then?

Thanks
Comment 6 Chris Cormack 2022-12-02 01:44:06 UTC
Thats right you have to have no db, so if you stop mariadb, or mysqlserver and run it will fail.
Comment 7 David Nind 2023-01-27 22:15:54 UTC
Created attachment 145780 [details] [review]
Bug 32375: Move t/AuthoritiesMarc_MARC21.t to t/db_dependent

t/AuthoritiesMarc_MARC21.t is now database dependent so it
needs to be in t/db_dependent to pass the tests.

Test plan (using koha-testing-docker):
1. If you run prove t/AuthoritiesMarc_MARC21.t without stopping
   the database, the tests will pass. To get the tests to fail:
   1.1 Stop the database - from a new terminal window run:
       docker stop koha-db-1
   1.2 In your Koha container run: prove t/AuthoritiesMarc_MARC21.t
       ==> The tests fail 8-(
2. Restart the database container from the terminal window you
   stopped it in: docker start koha-db-1
3. Apply the patch in the Koha container as normal.
4. Run: prove t/db_dependent/AuthoritiesMarc_MARC21.t
   ==> The test pass!
5. Sign off D:

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2023-01-27 22:17:52 UTC
I tested with koha-testing-docker (KTD) and updated the commit message to format the bug title as expected by the QA Team and added the test plan I used.

I hope what I've done is sufficient/correct!
Comment 9 Victor Grousset/tuxayo 2023-03-06 21:41:32 UTC
Created attachment 147811 [details] [review]
Bug 32375: Move t/AuthoritiesMarc_MARC21.t to t/db_dependent

t/AuthoritiesMarc_MARC21.t is now database dependent so it
needs to be in t/db_dependent to pass the tests.

Test plan (using koha-testing-docker):
1. If you run prove t/AuthoritiesMarc_MARC21.t without stopping
   the database, the tests will pass. To get the tests to fail:
   1.1 Stop the database - from a new terminal window run:
       docker stop koha-db-1
   1.2 In your Koha container run: prove t/AuthoritiesMarc_MARC21.t
       ==> The tests fail 8-(
2. Restart the database container from the terminal window you
   stopped it in: docker start koha-db-1
3. Apply the patch in the Koha container as normal.
4. Run: prove t/db_dependent/AuthoritiesMarc_MARC21.t
   ==> The test pass!
5. Sign off D:

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 10 Victor Grousset/tuxayo 2023-03-06 21:43:23 UTC
Works, QA script happy, change looks good, passing QA :)
Comment 11 Lucas Gass (lukeg) 2023-03-07 13:13:02 UTC
Backported to 22.05.x for upcoming 22.05.11
Comment 12 Arthur Suzuki 2023-03-29 12:24:15 UTC
applied to 21.11 for 21.11.19
Comment 13 Wainui Witika-Park 2023-04-27 04:33:20 UTC
Not backported to 21.05.x