mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 19:24:02 +00:00
Test that the tenant connections get closed after jobs get processed
This commit is contained in:
parent
42dc85666f
commit
c5d98aee33
1 changed files with 14 additions and 0 deletions
|
|
@ -181,6 +181,20 @@ test('the tenant used by the job doesnt change when the current tenant changes',
|
|||
expect(pest()->valuestore->get('tenant_id'))->toBe('The current tenant id is: acme');
|
||||
});
|
||||
|
||||
test('tenant connections do not persist after tenant jobs get processed', function() {
|
||||
withTenantDatabases();
|
||||
|
||||
$tenant = Tenant::create();
|
||||
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
dispatch(new TestJob(pest()->valuestore));
|
||||
|
||||
pest()->artisan('queue:work --once');
|
||||
|
||||
expect(collect(DB::select('SHOW FULL PROCESSLIST'))->pluck('db'))->not()->toContain($tenant->database()->getName());
|
||||
});
|
||||
|
||||
function createValueStore(): void
|
||||
{
|
||||
$valueStorePath = __DIR__ . '/Etc/tmp/queuetest.json';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue