fix(vikon): check HTTP status instead of JSON field for part generation check
This commit is contained in:
@@ -55,15 +55,15 @@ class UpdatePartAction
|
|||||||
throw new \RuntimeException("Part generation failed: {$error}");
|
throw new \RuntimeException("Part generation failed: {$error}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3: Check result
|
// Step 3: Check result (API returns HTTP 200 on success, no JSON body needed)
|
||||||
$checkResponse = $this->http->getWithToken(
|
$checkResponse = $this->http->getWithToken(
|
||||||
"pull_updates/checkPartGenerationByNewCoreResultJson?operation_identity={$operationIdentity}&part={$part}",
|
"pull_updates/checkPartGenerationByNewCoreResultJson?operation_identity={$operationIdentity}&part={$part}",
|
||||||
$accessToken
|
$accessToken
|
||||||
);
|
);
|
||||||
$checkBody = $checkResponse->json();
|
|
||||||
|
|
||||||
if (empty($checkBody['success'])) {
|
if ($checkResponse->failed()) {
|
||||||
throw new \RuntimeException('Part not ready: ' . ($checkBody['message'] ?? 'Unknown'));
|
$body = $checkResponse->json([]);
|
||||||
|
throw new \RuntimeException('Part not ready: ' . ($body['message'] ?? 'HTTP ' . $checkResponse->status()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 4: Download ZIP
|
// Step 4: Download ZIP
|
||||||
|
|||||||
@@ -85,10 +85,12 @@ class UpdatePartActionTest extends TestCase
|
|||||||
->with('op-abc-123', 'token')
|
->with('op-abc-123', 'token')
|
||||||
->andReturn(['status' => 'completed']);
|
->andReturn(['status' => 'completed']);
|
||||||
|
|
||||||
|
$checkResponse = Mockery::mock(Response::class);
|
||||||
|
$checkResponse->shouldReceive('failed')->once()->andReturn(false);
|
||||||
$http->shouldReceive('getWithToken')
|
$http->shouldReceive('getWithToken')
|
||||||
->once()
|
->once()
|
||||||
->with('pull_updates/checkPartGenerationByNewCoreResultJson?operation_identity=op-abc-123&part=common', 'token')
|
->with('pull_updates/checkPartGenerationByNewCoreResultJson?operation_identity=op-abc-123&part=common', 'token')
|
||||||
->andReturn($this->mockResponse(['success' => true]));
|
->andReturn($checkResponse);
|
||||||
|
|
||||||
// Create a minimal ZIP
|
// Create a minimal ZIP
|
||||||
$tempZipDir = $this->tempDir . '/zip_source';
|
$tempZipDir = $this->tempDir . '/zip_source';
|
||||||
|
|||||||
Reference in New Issue
Block a user