Skip to content

Commit 5dde790

Browse files
committed
Fix Windows integration tests: disable SSL via PGSQL_TEST_NO_SSL env
Windows CI runs PostgreSQL without TLS (chmod/SSL not supported). Integration tests now check PGSQL_TEST_NO_SSL env var to use ssl_mode=Disable instead of Require. Set automatically in CI for Windows runner.
1 parent 3f273ca commit 5dde790

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,6 @@ jobs:
101101
- name: Integration tests (Windows)
102102
if: runner.os == 'Windows'
103103
shell: bash
104+
env:
105+
PGSQL_TEST_NO_SSL: "1"
104106
run: make test-integration

src/tests/integration_test.mbt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
/// Start with: ./tests/setup-pg.sh start
88
/// Run with: moon test --target native tests/
99
fn get_config() -> @pgsql.Config {
10+
// Use Disable when PGSQL_TEST_NO_SSL is set (e.g. Windows CI without TLS)
11+
let ssl_mode : @pgsql.SslMode = match @sys.get_env_var("PGSQL_TEST_NO_SSL") {
12+
Some(_) => Disable
13+
None => Require
14+
}
1015
@pgsql.Config::new(
1116
"postgres",
1217
"postgres",
1318
"postgres",
1419
host="127.0.0.1",
1520
port=5433,
16-
ssl_mode=Require,
21+
ssl_mode~,
1722
)
1823
}
1924

@@ -593,7 +598,7 @@ async test "auth error: wrong password" {
593598
"postgres",
594599
host="127.0.0.1",
595600
port=5433,
596-
ssl_mode=Require,
601+
ssl_mode=get_config().ssl_mode(),
597602
)
598603
let mut got_auth_error = false
599604
ignore((@pgsql.Client::connect(bad_config) : @pgsql.Client)) catch {

src/tests/moon.pkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
"bikallem/pgsql" @pgsql,
33
"moonbitlang/async",
44
"moonbitlang/core/encoding/utf8" @utf8,
5+
"moonbitlang/x/sys" @sys,
56
} for "test"
67

78
options(

src/tests/setup-pg.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ start() {
7777
ssl_enabled=on
7878
else
7979
echo "Note: starting without TLS (Windows or openssl unavailable)"
80+
export PGSQL_TEST_NO_SSL=1
8081
fi
8182

8283
# Configure postgresql.conf

0 commit comments

Comments
 (0)