Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--chunk-size won't work with --testsuite option in version 1.3.0 #274

Open
ilario-pierbattista opened this issue Sep 27, 2024 · 5 comments
Labels

Comments

@ilario-pierbattista
Copy link
Member

ilario-pierbattista commented Sep 27, 2024

If I try to execute

paraunit run --testsuite=functional --chunk-size=5

then paraunit exits with no test executed.

With the --debug flag it prints

PROCESS STARTED: /app/phpunit.xml_0.dist
'php' '/app/vendor/phpunit/phpunit/phpunit' '--extensions=Paraunit\Parser\JSON\TestHook\BeforeTest,Paraunit\Parser\JSON\TestHook\Error,Paraunit\Parser\JSON\TestHook\Failure,Paraunit\Parser\JSON\TestHook\Incomplete,Paraunit\Parser\JSON\TestHook\Risky,Paraunit\Parser\JSON\TestHook\Skipped,Paraunit\Parser\JSON\TestHook\Successful,Paraunit\Parser\JSON\TestHook\Warning' '--testsuite=functional' '--configuration=/app/phpunit.xml_0.dist'

With the content of /app/phpunit.xml_0.dist being

    <testsuites>
        <testsuite name="Tests Suite 0">
         <!-- .... list of files here -->
        </testsuite>
    </testsuites>

The command used for the subprocess takes the --testsuite=functional option the paraunit command.
Hence, each process won't execute any test.

I would expect the --testsuite option to be used before the chunks are created, and then it won't be an option of the sub process command.

What do you think?

@ilario-pierbattista ilario-pierbattista changed the title --chunk-size won't work with --test-suite option in version 1.3.0 --chunk-size won't work with --testsuite option in version 1.3.0 Sep 27, 2024
@Jean85
Copy link
Member

Jean85 commented Sep 30, 2024

In normal execution the PassThrough class would forward all options from the base Paraunit execution to the PHPunit one, but that doesn't happen with chunks:

if ($this->chunkSize->isChunked()) {
$command = array_merge(
$this->baseCommandLine,
['--configuration=' . $testFilePath],
$this->cliCommand->getSpecificOptions($testFilePath)
);
} else {
$command = array_merge(
$this->baseCommandLine,
[$testFilePath],
$this->passThrough->options,
$this->cliCommand->getSpecificOptions($testFilePath)
);
}

I do not understand how this is happening..

@Jean85 Jean85 added the bug label Sep 30, 2024
@pczerkas
Copy link
Contributor

pczerkas commented Sep 30, 2024

PassThrough was added at least one year later after chunking ...
f4eb32f
Since it was added only in normal flow, maybe it was concluded that this option is not possible, when using chunking?

Jean85 added a commit that referenced this issue Oct 2, 2024
@Jean85
Copy link
Member

Jean85 commented Oct 2, 2024

@ilario-pierbattista I'm sorry but I'm unable to reproduce the issue, I've tried with #276, both under 1.x and 2.x, and the --testsuite options does not get appended to the PHPUnit processes execution. Are you sure you do not have something else interfering?

@ilario-pierbattista
Copy link
Member Author

ilario-pierbattista commented Oct 2, 2024

@Jean85 I've just updated #276 to reproduce it.

The problem seems to be \Paraunit\Command\ParallelCommand::addPHPUnitOptions and the way PHPUnitConfig gets configured in 1.x.
In \Paraunit\Process\ProcessFactory::create where baseCommandLine contains also the --testsuite.

Probabily it don't affect 2.x.

Given that testsuite is the way tests are chunked in PHPUnit config files, maybe we could explicitly exclude the testsuite option in the ProcessFactory.

Edit: fix (almost) ready in #277

@ilario-pierbattista
Copy link
Member Author

@Jean85 thank you for releasing 1.3.1, it runs as expected 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants