Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions tests/Acceptance/IntegrationFixtureRunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,44 @@ public function partialProvisioningFailureCleansAndFailsBeforeTestsStart(): void
}

#[Test]
public function cleanupFailureFailsAnOtherwiseSuccessfulRun(): void
#[DataSet('workerCounts')]
public function provisioningAndRollbackFailuresAreBothReported(int $workers): void
{
$project = $this->writeProject('cleanup-failure', workers: 1, failCleanup: true);
$project = $this->writeProject(
'provisioning-and-rollback-failure-' . $workers,
workers: $workers,
failProvisioning: true,
failCleanup: true,
);
$result = GreenlightCli::run($project->directory, ['run', '--reporter=plain']);

Expect::that($result->exitCode)->toBe(1)
->and($result->output())
->because('the provisioning failure MUST remain the primary run failure')
->toContain('intentional fixture provisioning failure')
->and($result->output())
->because('rollback failures MUST remain visible after a provisioning failure')
->toContain('Additionally, cleanup for integration fixture "probe" failed')
->toContain('intentional fixture cleanup failure')
->not()->toContain('tests,')
->not()->toContain('fixture-secret')
->and($this->matches($project->path('markers/resource-*')))->toBe([])
->and($this->lines($project->path('markers/cleaned.log')))->toBe(['cleaned']);
}

#[Test]
#[DataSet('workerCounts')]
public function cleanupFailureFailsAnOtherwiseSuccessfulRun(int $workers): void
{
$project = $this->writeProject('cleanup-failure-' . $workers, workers: $workers, failCleanup: true);
$result = GreenlightCli::run($project->directory, ['run', '--reporter=plain']);

Expect::that($result->exitCode)->toBe(1)
->and($result->output())->toContain('Integration fixture teardown failed.')
->and($result->output())->toContain('intentional fixture cleanup failure')
->and($this->matches($project->path('markers/resource-*')))->toBe([]);
->not()->toContain('fixture-secret')
->and($this->matches($project->path('markers/resource-*')))->toBe([])
->and($this->lines($project->path('markers/cleaned.log')))->toBe(['cleaned']);
}

#[Test]
Expand Down Expand Up @@ -175,6 +204,15 @@ public static function workerModes(): iterable
yield 'parallel' => [2, 2];
}

/**
* @return iterable<string, array{positive-int}>
*/
public static function workerCounts(): iterable
{
yield 'in-process' => [1];
yield 'parallel' => [2];
}

/**
* @return list<string>
*/
Expand Down