Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions .github/workflows/queues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,25 @@ jobs:
redis-server --daemonize yes --port 7002 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7002.conf
redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0 --cluster-yes

- name: Check Redis Cluster is ready
uses: nick-fields/retry@v3
with:
timeout_seconds: 5
max_attempts: 5
retry_wait_seconds: 5
retry_on: error
command: |
redis-cli -c -h 127.0.0.1 -p 7000 cluster info | grep "cluster_state:ok"
redis-cli -c -h 127.0.0.1 -p 7001 cluster info | grep "cluster_state:ok"
redis-cli -c -h 127.0.0.1 -p 7002 cluster info | grep "cluster_state:ok"

- name: Execute tests
run: vendor/bin/phpunit tests/Integration/Queue
env:
REDIS_CLIENT: ${{ matrix.client }}
REDIS_CLUSTER_HOSTS_AND_PORTS: 127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002
REDIS_QUEUE: '{default}'
QUEUE_CONNECTION: redis

beanstalkd:
runs-on: ubuntu-24.04
Expand Down
12 changes: 12 additions & 0 deletions tests/Integration/Queue/JobChainingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ public function testDynamicBatchCanBeAddedToChain()
$this->assertEquals(
['c1', 'c2', 'b1', 'b2-0', 'b2-1', 'b2-2', 'b2-3', 'b2', 'b3', 'b4', 'c3'], JobRunRecorder::$results
);
} else {
$this->assertEquals(
['c1', 'c2', 'b1', 'b2', 'b3', 'b4', 'b2-0', 'b2-1', 'b2-2', 'b2-3', 'c3'], JobRunRecorder::$results
);
}

$this->assertCount(11, JobRunRecorder::$results);
Expand Down Expand Up @@ -445,6 +449,10 @@ public function testChainBatchChain()
$this->assertEquals(
['c1', 'c2', 'bc1', 'bc2', 'b1', 'b2-0', 'b2-1', 'b2-2', 'b2-3', 'b2', 'b3', 'b4', 'c3'], JobRunRecorder::$results
);
} else {
$this->assertEquals(
['c1', 'c2', 'bc1', 'b1', 'b2', 'b3', 'b4', 'bc2', 'b2-0', 'b2-1', 'b2-2', 'b2-3', 'c3'], JobRunRecorder::$results
);
}

$this->assertCount(13, JobRunRecorder::$results);
Expand Down Expand Up @@ -478,6 +486,10 @@ public function testChainBatchChainBatch()
$this->assertEquals(
['c1', 'c2', 'bc1', 'bc2', 'bb1', 'bb2', 'b1', 'b2-0', 'b2-1', 'b2-2', 'b2-3', 'b2', 'b3', 'b4', 'c3'], JobRunRecorder::$results
);
} else {
$this->assertEquals(
['c1', 'c2', 'bc1', 'b1', 'b2', 'b3', 'b4', 'bc2', 'b2-0', 'b2-1', 'b2-2', 'b2-3', 'bb1', 'bb2', 'c3'], JobRunRecorder::$results
);
}

$this->assertCount(15, JobRunRecorder::$results);
Expand Down
21 changes: 20 additions & 1 deletion tests/Integration/Queue/QueueTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Illuminate\Tests\Integration\Queue;

use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Orchestra\Testbench\TestCase;

abstract class QueueTestCase extends TestCase
{
use DatabaseMigrations;
use DatabaseMigrations, InteractsWithRedis;

/**
* The current database driver.
Expand All @@ -27,6 +28,24 @@ protected function defineEnvironment($app)
$this->driver = $app['config']->get('queue.default', 'sync');
}

#[\Override]
protected function setUp(): void
{
$this->afterApplicationCreated(function () {
if ($this->getQueueDriver() === 'redis') {
$this->setUpRedis();
}
});

$this->beforeApplicationDestroyed(function () {
if ($this->getQueueDriver() === 'redis') {
$this->tearDownRedis();
}
});

parent::setUp();
}

/**
* Run queue worker command.
*
Expand Down
Loading