Skip to content

Commit

Permalink
Adjust some tests for Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Dec 27, 2023
1 parent 0a0ab6b commit 75cfed9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
php-extensions: parallel
job-description: 'with ext-parallel'
php-ts: ts
static-analysis: none
style-fix: none
composer-require-checker-version: none
continue-on-error: true

- operating-system: 'ubuntu-latest'
Expand All @@ -42,7 +45,7 @@ jobs:
continue-on-error: true

- operating-system: 'macos-latest'
php-version: '8.2'
php-version: '8.3'
job-description: 'on macOS'
php-ts: nts
continue-on-error: false
Expand Down
7 changes: 6 additions & 1 deletion test/Worker/AbstractPoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Amp\Parallel\Worker\Task;
use Amp\Parallel\Worker\Worker;
use Amp\Parallel\Worker\WorkerPool;
use const Amp\Process\IS_WINDOWS;

abstract class AbstractPoolTest extends AbstractWorkerTest
{
Expand Down Expand Up @@ -108,6 +109,10 @@ public function testCreatePoolShouldThrowError(): void

public function testCleanGarbageCollection(): void
{
if (IS_WINDOWS) {
$this->markTestSkipped('Skipping on Windows for now');
}

// See https://github.com/amphp/parallel-functions/issues/5
for ($i = 0; $i < 3; $i++) {
$pool = $this->createPool(32);
Expand Down Expand Up @@ -158,7 +163,7 @@ public function testWaitingForAvailableWorker(): void
$delay = 0.1;

$this->setMinimumRuntime($delay * $count);
$this->setTimeout($delay * $count * 2);
$this->setTimeout($delay * $count * 3);

$pool = $this->createPool(1);

Expand Down
6 changes: 4 additions & 2 deletions test/Worker/AbstractWorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public function testSubmitMultipleThenShutdown(): void
$worker->submit(new Fixtures\TestTask(72, 0.1))->getFuture(),
];

delay(0);

// Send shutdown signal, but don't await until tasks have finished.
$shutdown = async(fn () => $worker->shutdown());

Expand All @@ -134,8 +136,8 @@ public function testNotIdleOnSubmit(): void
{
$worker = $this->createWorker();

$future = $worker->submit(new Fixtures\TestTask(42))->getFuture();
delay(0); // Tick event loop to call Worker::submit()
$future = $worker->submit(new Fixtures\TestTask(42, 0.5))->getFuture();
delay(0.1); // Tick event loop to call Worker::submit()
self::assertFalse($worker->isIdle());
$future->await();

Expand Down

0 comments on commit 75cfed9

Please sign in to comment.