Skip to content

Commit f709db8

Browse files
committed
Fix integration tests skipped in parallel mode + CI hardening
The skip guard ->skip(!pebbleAvailable(), ...) evaluated pebbleAvailable() in the orchestrator process before Pest workers were spawned, caching false and freezing all tests as skipped. Using a closure ->skip(fn () => ...) defers evaluation to each worker where the env var is live. Also: add PEBBLE_WFE_NONCEREJECT=0 (eliminates 5% nonce rejection) and a Docker health check so GitHub Actions confirms Pebble is ready before any step runs rather than relying solely on the wait loop.
1 parent d5e5d0a commit f709db8

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
env:
2626
PEBBLE_VA_NOSLEEP: "1"
2727
PEBBLE_VA_ALWAYS_VALID: "1"
28+
PEBBLE_WFE_NONCEREJECT: "0"
29+
options: >-
30+
--health-cmd "curl -sk https://localhost:14000/dir > /dev/null || exit 1"
31+
--health-interval 5s
32+
--health-timeout 3s
33+
--health-retries 10
2834
2935
steps:
3036
- uses: actions/checkout@v6

tests/Integration/CoyoteCertIssueTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
expect($cert->fullchain)->toContain('-----BEGIN CERTIFICATE-----');
2121
expect($cert->domains)->toBe(['test.example.com']);
2222
expect(openssl_x509_parse($cert->certificate))->toBeArray();
23-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
23+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');
2424

2525
it('issues a certificate with an EC P-256 account key', function () {
2626
$cert = CoyoteCert::with(pebble())
@@ -32,7 +32,7 @@
3232
->issue();
3333

3434
expect($cert->certificate)->toContain('-----BEGIN CERTIFICATE-----');
35-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
35+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');
3636

3737
it('reuses an existing account on a second issue', function () {
3838
$storage = new InMemoryStorage();
@@ -54,7 +54,7 @@
5454

5555
expect($first->certificate)->not->toBe($second->certificate);
5656
expect($second->certificate)->toContain('-----BEGIN CERTIFICATE-----');
57-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
57+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');
5858

5959
it('issueOrRenew returns the cached cert when still valid', function () {
6060
$storage = new InMemoryStorage();
@@ -74,7 +74,7 @@
7474
->issueOrRenew(daysBeforeExpiry: 1);
7575

7676
expect($returned->certificate)->toBe($issued->certificate);
77-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
77+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');
7878

7979
it('issues a certificate with the shortlived profile', function () {
8080
$cert = CoyoteCert::with(pebble())
@@ -86,4 +86,4 @@
8686
->issue();
8787

8888
expect($cert->certificate)->toContain('-----BEGIN CERTIFICATE-----');
89-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
89+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');

tests/Integration/CoyoteCertRevokeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
->revoke($cert);
2020

2121
expect($result)->toBeTrue();
22-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
22+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');
2323

2424
it('revokes with a specific reason code', function () {
2525
$storage = new InMemoryStorage();
@@ -36,7 +36,7 @@
3636
->revoke($cert, reason: 1); // keyCompromise
3737

3838
expect($result)->toBeTrue();
39-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
39+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');
4040

4141
it('throws when revoke is called without storage', function () {
4242
$storage = new InMemoryStorage();
@@ -50,4 +50,4 @@
5050

5151
expect(fn () => CoyoteCert::with(pebble())->revoke($cert))
5252
->toThrow(\CoyoteCert\Exceptions\LetsEncryptClientException::class);
53-
})->skip(!pebbleAvailable(), 'Pebble not running — skipping integration tests');
53+
})->skip(fn () => !pebbleAvailable(), 'Pebble not running — skipping integration tests');

0 commit comments

Comments
 (0)