Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Thu, 01 May 2025 17:23:53 +0000 Subject: [pgjdbc/pgjdbc] PR #3614: test: simplify TestUtil.openDB, add tests with various assumeMinServerVersion values List-Id: X-GitHub-Author-Id: 213894 X-GitHub-Author-Login: vlsi X-GitHub-Issue: 3614 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: merged X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3614 Content-Type: text/plain; charset=utf-8 Previously, the code considered only a few of PGProperty names when creating a database connection. So there was no possibility to set the rest of the properties by passing them with build.properties or -D... After the change, the code uses all the matching properties from System.properties, so we can increase test coverage. For instance, the change adds tests with assumeMinServerVersion setting. I still do not like how `Properties` contents is copied all over the place, however, we can't do better as we do not have `Properties(List)` factory yet. This test would have caught https://github.com/pgjdbc/pgjdbc/issues/3508 earlier. The idea behind the change is: * Prefer pgjdbc property names (the ones in `PGProperty`). For instance, previously, `build.properties` included a property named `username` which was handled in a special way since `PGProperty.USER` has a value of `user`. That is the reason I changed `server` to `test.url.PGHOST` which effectively means "use it as a default PGHOST value, and pass it via the URL rather than props object) * host/port/database was handled separately when building the URL. Now the logic is that any property can be passed to the URL when building the URL with `TestUtil`. The `test.url.` prefix allows to configure which properties should be passed with the URL (`TestUtil` strips the prefix and adds the rest as a query parameter, etc)