Skip to content

Commit 91db586

Browse files
committed
Test both plaintext and TLS connections with PSQL
1 parent 1d20b9a commit 91db586

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

.github/workflows/test.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,27 @@ jobs:
130130
EOF
131131
132132
- name: Run GatewayD with template plugin 🚀
133-
run: GATEWAYD_LOGGERS_DEFAULT_LEVEL=debug ./gatewayd run &
133+
run: ./gatewayd run -c testdata/gatewayd_tls.yaml &
134134

135-
- name: Run a test with PSQL 🧪
135+
- name: Install PSQL 🧑‍💻
136136
run: |
137137
sudo apt-get update
138138
sudo apt-get install --yes --no-install-recommends postgresql-client
139+
140+
- name: Run a test with PSQL over plaintext connection 🧪
141+
run: |
139142
psql ${PGURL} -c "CREATE TABLE test_table (id serial PRIMARY KEY, name varchar(255));" | grep CREATE || exit 1
140143
psql ${PGURL} -c "INSERT INTO test_table (name) VALUES ('test');" | grep INSERT || exit 1
141144
psql ${PGURL} -c "SELECT * FROM test_table;" | grep test || exit 1
145+
psql ${PGURL} -c "DROP TABLE test_table;" | grep DROP || exit 1
146+
env:
147+
PGURL: postgres://postgres:postgres@localhost:15432/postgres?sslmode=disable
148+
149+
- name: Run a test with PSQL over TLS connection 🧪
150+
run: |
151+
psql ${PGURL_TLS} -c "CREATE TABLE test_table (id serial PRIMARY KEY, name varchar(255));" | grep CREATE || exit 1
152+
psql ${PGURL_TLS} -c "INSERT INTO test_table (name) VALUES ('test');" | grep INSERT || exit 1
153+
psql ${PGURL_TLS} -c "SELECT * FROM test_table;" | grep test || exit 1
154+
psql ${PGURL_TLS} -c "DROP TABLE test_table;" | grep DROP || exit 1
142155
env:
143-
PGURL: postgres://postgres:postgres@localhost:15432/postgres
156+
PGURL_TLS: postgres://postgres:postgres@localhost:15432/postgres?sslmode=require

testdata/gatewayd_tls.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# GatewayD Global Configuration
2+
3+
loggers:
4+
default:
5+
level: debug
6+
output: ["console"]
7+
noColor: True
8+
9+
metrics:
10+
default:
11+
enabled: True
12+
13+
clients:
14+
default:
15+
address: localhost:5432
16+
17+
pools:
18+
default:
19+
size: 10
20+
21+
proxies:
22+
default:
23+
elastic: False
24+
25+
servers:
26+
default:
27+
address: 0.0.0.0:15432
28+
enableTLS: True
29+
certFile: cmd/testdata/localhost.crt
30+
keyFile: cmd/testdata/localhost.key
31+
32+
api:
33+
enabled: True

0 commit comments

Comments
 (0)