Skip to content

Commit cf3a132

Browse files
committed
refactor: streamline RRStarter initialization by embedding allowed test classes directly in State, remove unused method parameter
1 parent e741909 commit cf3a132

4 files changed

Lines changed: 17 additions & 6 deletions

File tree

tests/Acceptance/App/Runtime/RRStarter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
final class RRStarter
1212
{
1313
private Environment $environment;
14+
1415
public function __construct(
1516
private State $runtime,
1617
?Environment $environment = null,
@@ -19,15 +20,14 @@ public function __construct(
1920
\register_shutdown_function(fn() => $this->stop());
2021
}
2122

22-
/**
23-
* @param list<class-string> $allowedTestClasses
24-
*/
25-
public function start(array $allowedTestClasses = []): void
23+
public function start(): void
2624
{
2725
if ($this->environment->isRoadRunnerRunning()) {
2826
return;
2927
}
3028

29+
$allowedTestClasses = $this->runtime->allowedTestClasses;
30+
3131
$systemInfo = SystemInfo::detect();
3232
$run = $this->runtime->command;
3333

tests/Acceptance/App/Runtime/State.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ final class State
1818
/** @var non-empty-string */
1919
public string $address;
2020

21+
/**
22+
* @var list<class-string> Test classes the worker pool was bootstrapped with.
23+
* Honored by RRStarter on initial start AND on every restart, so failure-triggered
24+
* restarts preserve the same selection instead of falling back to "register all".
25+
*/
26+
public array $allowedTestClasses = [];
27+
2128
/**
2229
* @param non-empty-string $rrConfigDir Dir with rr.yaml
2330
* @param non-empty-string $workDir Dir where tests are run

tests/Acceptance/App/RuntimeBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public static function createState(
7373
array $allowedTestClasses = [],
7474
): State {
7575
$runtime = new State($command, \dirname(__DIR__), $workDir, $testCasesDir, $workers);
76+
$runtime->allowedTestClasses = $allowedTestClasses;
7677

7778
self::hydrateClasses($runtime, $allowedTestClasses);
7879

tests/Acceptance/ExecutionStartedSubscriber.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public function notify(ExecutionStarted $event): void
5757
}
5858

5959
$logger = new StderrLogger();
60-
$logger->info('[selection] picked test classes after filtering', ['count' => \count($selectedTestClasses)]);
60+
$logger->info('[selection] picked test classes after filtering', [
61+
'count' => \count($selectedTestClasses),
62+
'classes' => $selectedTestClasses,
63+
]);
6164

6265
RuntimeBuilder::init();
6366

@@ -95,7 +98,7 @@ public function notify(ExecutionStarted $event): void
9598
$temporalRunner = new TemporalStarter($environment);
9699
$rrRunner = new RRStarter($state, $environment);
97100
$temporalRunner->start();
98-
$rrRunner->start($selectedTestClasses);
101+
$rrRunner->start();
99102

100103
$serviceClient = $state->command->tlsKey === null && $state->command->tlsCert === null
101104
? ServiceClient::create($state->address)

0 commit comments

Comments
 (0)