|
5 | 5 | namespace Hypernode\Deploy\Tests\Unit\Brancher; |
6 | 6 |
|
7 | 7 | use Hypernode\Api\Exception\HypernodeApiClientException; |
| 8 | +use Hypernode\Api\Exception\HypernodeApiServerException; |
8 | 9 | use Hypernode\Api\HypernodeClient; |
9 | 10 | use Hypernode\Api\Resource\Logbook\Flow; |
10 | 11 | use Hypernode\Api\Service\BrancherApp; |
@@ -165,6 +166,25 @@ public function testLogbookNon404ErrorPropagates(): void |
165 | 166 | $this->manager->waitForAvailability('test-brancher', 1500, 6, 10); |
166 | 167 | } |
167 | 168 |
|
| 169 | + public function testLogbookServerErrorPropagates(): void |
| 170 | + { |
| 171 | + $this->sshPoller->pollResults = array_fill(0, 5, false); |
| 172 | + |
| 173 | + $response = $this->createMock(ResponseInterface::class); |
| 174 | + $response->method('getStatusCode')->willReturn(503); |
| 175 | + $response->method('getBody')->willReturn('Service Unavailable'); |
| 176 | + $exception503 = new HypernodeApiServerException($response); |
| 177 | + |
| 178 | + $this->logbook->expects($this->once()) |
| 179 | + ->method('getList') |
| 180 | + ->with('test-brancher') |
| 181 | + ->willThrowException($exception503); |
| 182 | + |
| 183 | + $this->expectException(HypernodeApiServerException::class); |
| 184 | + |
| 185 | + $this->manager->waitForAvailability('test-brancher', 1500, 6, 10); |
| 186 | + } |
| 187 | + |
168 | 188 | public function testSshFirstCheckIntermittentFailuresResetCounter(): void |
169 | 189 | { |
170 | 190 | $this->sshPoller->pollResults = [true, true, false, true, true, true]; |
|
0 commit comments