From f71033b30dc20c67e6ed336178d1ac0144ea5c8a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 15 Jan 2024 19:11:25 +0100 Subject: tests: Remove id from db fixtures. It seems that PostgreSQL will not update the autoincrement index of the table when inserting rows with an id set. Later inserts without an id set will then fail, because they get assigned an id that already exists. MySQL seems to handle this just fine. Why the id column was added in the first place, one may wonder, but that's how it were. In any case, this broke the PostgreSQL tests in the gitlab CI environment. (While it mysteriously worked in my local ddev environment.) Anyways, the id column is not needed, and things work better without them. --- tests/unit/includes/dba/_files/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/unit/includes/dba/_files/config.yml b/tests/unit/includes/dba/_files/config.yml index 80b9ba12f..a8034f2de 100644 --- a/tests/unit/includes/dba/_files/config.yml +++ b/tests/unit/includes/dba/_files/config.yml @@ -1,12 +1,10 @@ --- config: - - id: 1 cat: system k: do_not_check_dns v: true - - id: 2 cat: system k: not_allowed_email v: 'baduser@example.com,baddomain.com,*.evil.org' -- cgit v1.2.3 From ecd4754f6d904158606b39ce40af3d834e4550e0 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 15 Jan 2024 19:25:09 +0100 Subject: tests: Enable debug logging during tests The debug log will be stored in the test/results directory, and archived as part of the artifacts of the CI run. This should make it easier to get some debugging info out from the CI runs if they fail. --- tests/unit/UnitTestCase.php | 2 ++ tests/unit/includes/dba/_files/config.yml | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/unit/UnitTestCase.php b/tests/unit/UnitTestCase.php index 97ac1576e..0bf7b547a 100644 --- a/tests/unit/UnitTestCase.php +++ b/tests/unit/UnitTestCase.php @@ -72,6 +72,8 @@ class UnitTestCase extends TestCase { } protected function setUp() : void { + $myclass = get_class($this); + logger("[*] Running test: {$myclass}::{$this->getName(true)}", LOGGER_DEBUG); if ( \DBA::$dba->connected ) { // Create a transaction, so that any actions taken by the // tests does not change the actual contents of the database. diff --git a/tests/unit/includes/dba/_files/config.yml b/tests/unit/includes/dba/_files/config.yml index a8034f2de..e93486857 100644 --- a/tests/unit/includes/dba/_files/config.yml +++ b/tests/unit/includes/dba/_files/config.yml @@ -8,4 +8,16 @@ config: cat: system k: not_allowed_email v: 'baduser@example.com,baddomain.com,*.evil.org' + - + cat: system + k: debugging + v: true + - + cat: system + k: loglevel + v: 2 + - + cat: system + k: logfile + v: tests/results/unit_test.log -- cgit v1.2.3