Skip to content

Commit d94cad8

Browse files
ci(php): run TLS tests in CI (#3381)
1 parent a8dd3a9 commit d94cad8

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

.github/actions/php/pre-merge/action.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,39 @@ runs:
152152
IGGY_PASSWORD: iggy
153153
run: ./scripts/test.sh
154154

155-
- name: Stop Iggy server
155+
- name: Stop Iggy server (plain)
156156
if: always() && inputs.task == 'test'
157157
uses: ./.github/actions/utils/server-stop
158158
with:
159159
pid-file: ${{ steps.iggy.outputs.pid_file }}
160160
log-file: ${{ steps.iggy.outputs.log_file }}
161+
162+
- name: Start Iggy server (TLS)
163+
if: inputs.task == 'test'
164+
id: iggy-tls
165+
uses: ./.github/actions/utils/server-start
166+
with:
167+
pid-file: ${{ runner.temp }}/iggy-server-tls.pid
168+
log-file: ${{ runner.temp }}/iggy-server-tls.log
169+
env:
170+
IGGY_TCP_TLS_ENABLED: "true"
171+
IGGY_TCP_TLS_CERT_FILE: core/certs/iggy_cert.pem
172+
IGGY_TCP_TLS_KEY_FILE: core/certs/iggy_key.pem
173+
174+
- name: Run PHP SDK TLS tests
175+
if: inputs.task == 'test'
176+
shell: bash
177+
working-directory: foreign/php
178+
env:
179+
IGGY_HOST: 127.0.0.1
180+
IGGY_PORT: 8090
181+
IGGY_TLS_CONNECTION_STRING: iggy+tcp://iggy:iggy@127.0.0.1:8090?tls=true&tls_domain=localhost&tls_ca_file=${{ github.workspace }}/core/certs/iggy_ca_cert.pem
182+
IGGY_TLS_PLAINTEXT_ADDRESS: 127.0.0.1:8090
183+
run: ./scripts/test.sh tests/TlsTest.php
184+
185+
- name: Stop Iggy server (TLS)
186+
if: always() && inputs.task == 'test'
187+
uses: ./.github/actions/utils/server-stop
188+
with:
189+
pid-file: ${{ steps.iggy-tls.outputs.pid_file }}
190+
log-file: ${{ steps.iggy-tls.outputs.log_file }}

foreign/php/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ setup. Set `IGGY_TLS_CONNECTION_STRING` to enable TLS connection tests. Set
175175
TLS connection strings use the Rust SDK connection-string format, for example:
176176

177177
```text
178-
iggy+tcp://iggy:iggy@127.0.0.1:8090?tls=true&domain=localhost&ca_file=/path/to/ca.pem
178+
iggy+tcp://iggy:iggy@127.0.0.1:8090?tls=true&tls_domain=localhost&tls_ca_file=/path/to/ca.pem
179179
```
180180

181181
## API Notes

foreign/php/tests/TlsTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public function testConnectionStringWithTlsParams(): void
3838
$client = IggyClient::fromConnectionString($connectionString);
3939
$client->connect();
4040
$client->ping();
41+
42+
assert_true($client instanceof IggyClient, 'TLS client connected and pinged');
4143
}
4244

4345
public function testProduceAndConsumeOverTls(): void
@@ -81,6 +83,9 @@ public function testConnectWithoutTlsShouldFail(): void
8183
}
8284

8385
$client = new IggyClient($address);
84-
assert_throws(static fn () => $client->connect());
86+
assert_throws(static function () use ($client): void {
87+
$client->connect();
88+
$client->ping();
89+
});
8590
}
8691
}

0 commit comments

Comments
 (0)