Skip to content

Commit 0c3080d

Browse files
committed
Don't let network issues get you down
1 parent c831a03 commit 0c3080d

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

tests/ActivityPub/WebFingerTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
Exception\ClientException,
2323
Exception\GuzzleException,
2424
Exception\RequestException,
25+
Exception\ServerException,
2526
Handler\MockHandler,
2627
HandlerStack,
2728
Middleware,
2829
Psr7\Request,
29-
Psr7\Response
30-
};
30+
Psr7\Response};
3131
use ParagonIE\Certainty\{
3232
Exception\CertaintyException,
3333
RemoteFetch
@@ -53,7 +53,11 @@ class WebFingerTest extends TestCase
5353

5454
public function tearDown(): void
5555
{
56-
new WebFinger($this->getConfig())->clearCaches();
56+
try {
57+
new WebFinger($this->getConfig())->clearCaches();
58+
} catch (ServerException $ex) {
59+
$this->markTestSkipped($ex->getMessage());
60+
}
5761
}
5862

5963
public function testConstructorDefaults(): void

tests/Integration/ActorLifecycleTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
CoversClass,
7070
UsesClass
7171
};
72+
use GuzzleHttp\Exception\ServerException;
7273
use JsonException as BaseJsonException;
7374
use GuzzleHttp\Exception\GuzzleException;
7475
use ParagonIE\ConstantTime\Base64UrlSafe;
@@ -187,7 +188,11 @@ public function testOtherActionsWithPeerRewrapping(): void
187188
$this->clearOldTransaction($config);
188189
$protocol = new Protocol($config);
189190

190-
$wf = new WebFinger($config);
191+
try {
192+
$wf = new WebFinger($config);
193+
} catch (ServerException $ex) {
194+
$this->markTestSkipped($ex->getMessage());
195+
}
191196
$wf->setCanonicalForTesting($canonical, $canonical);
192197
$wf->setCanonicalForTesting($canonical2, $canonical2);
193198

tests/ProtocolTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
Handler
2828
};
2929
use GuzzleHttp\Exception\GuzzleException;
30+
use GuzzleHttp\Exception\ServerException;
3031
use ParagonIE\Certainty\Exception\CertaintyException;
3132
use ParagonIE\HPKE\KEM\PQKEM\EncapsKey;
3233
use ParagonIE\PQCrypto\Exception\MLDSAInternalException;
@@ -370,7 +371,12 @@ public function testMoveIdentity(): void
370371
$this->addTestPeer();
371372
[$oldActor, $canonical] = $this->makeDummyActor();
372373
[$newActor, $canonical2] = $this->makeDummyActor();
373-
$wf = new WebFinger($this->config);
374+
try {
375+
$wf = new WebFinger($this->config);
376+
} catch (ServerException $ex) {
377+
// Network issue, not a code issue:
378+
$this->markTestSkipped($ex->getMessage());
379+
}
374380
$wf->setCanonicalForTesting($oldActor, $canonical);
375381
$wf->setCanonicalForTesting($newActor, $canonical2);
376382
$wf->setCanonicalForTesting($canonical, $canonical);

tests/RequestHandlers/Api/ReplicaInfoTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Handler,
2424
ProtocolMessageInterface
2525
};
26+
use GuzzleHttp\Exception\ServerException;
2627
use FediE2EE\PKD\Crypto\{Merkle\InclusionProof, SecretKey, SymmetricKey};
2728
use GuzzleHttp\Psr7\Response;
2829
use FediE2EE\PKDServer\Protocol\{
@@ -168,7 +169,11 @@ public function beforeTests(): void
168169
[$canonical, $sk] = $this->makeAndStoreDummyActor();
169170

170171
// Next, let's kick off replication:
171-
$witness = new Witness($this->config);
172+
try {
173+
$witness = new Witness($this->config);
174+
} catch (ServerException $ex) {
175+
$this->markTestSkipped($ex->getMessage());
176+
}
172177
$witness->run();
173178

174179
// Now let's store the dummy info:

0 commit comments

Comments
 (0)