Bug 40446

Summary: DB config used by Cypress (mysql2) is not configurable
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: Pushed to stable --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: normal    
Priority: P5 - low CC: david, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41362
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
26.05.00,25.11.02
Circulation function:
Bug Depends on: 41362, 40170    
Bug Blocks:    
Attachments: Bug 40446: Allow overriding Cypress DB settings
Bug 40446: Allow overriding Cypress DB settings

Description Jonathan Druart 2025-07-18 10:30:36 UTC
It's hardcoded to work with ktd, but it should be more flexible

const connectionConfig = {
    host: "db",
    user: "koha_kohadev",
    password: "password",
    database: "koha_kohadev",
};
Comment 1 Jonathan Druart 2025-12-04 08:35:59 UTC
This should work:

const connectionConfig = {
  host: process.env.DB_HOSTNAME || "db",
  user: process.env.DB_USER || "koha_kohadev",
  password: process.env.DB_PASSWORD || "password",
  database: process.env.DB_NAME || "koha_kohadev",
};
Comment 2 Tomás Cohen Arazi (tcohen) 2025-12-04 17:43:02 UTC
Created attachment 190160 [details] [review]
Bug 40446: Allow overriding Cypress DB settings

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Comment 3 David Nind 2025-12-22 04:01:40 UTC
Changed assignee.

Sorry, have no idea how to test this one.
Comment 4 Jonathan Druart 2026-01-06 09:39:00 UTC
Created attachment 190921 [details] [review]
Bug 40446: Allow overriding Cypress DB settings

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>

Amended-by: Jonathan Druart
tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Jonathan Druart 2026-01-06 09:40:21 UTC
To test I've checked that the 4 env vars were defined in ktd, then adjusted them add made sure the test (eg. t/cypress/integration/t/db.ts) then failed

$ env|grep DB_
DB_PASSWORD=password
DB_HOSTNAME=db
DB_USER=koha_kohadev
DB_NAME=xkoha_kohadev
Comment 6 Lucas Gass (lukeg) 2026-01-06 14:34:01 UTC
Nice work everyone!

Pushed to main for 26.05
Comment 7 Chloé Zermatten 2026-02-03 15:01:56 UTC
All pushed to 25.11.x Thanks all!