mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
Update DockerTest.php
This commit is contained in:
parent
aa48915b05
commit
8dc9b2537b
1 changed files with 24 additions and 3 deletions
|
@ -5,6 +5,7 @@ namespace tests\Unit;
|
|||
use App\Models\User;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Pages\DockerCatalog;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerContainerResource;
|
||||
use Modules\Docker\PostInstall;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
@ -29,9 +30,11 @@ class DockerTest extends TestCase
|
|||
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
$livewireCatalogIndex = Livewire::test(DockerCatalog::class)
|
||||
->set('keyword', 'nginx')
|
||||
->assertSee('nginx');
|
||||
$dockerImage = 'nginx';
|
||||
|
||||
$dockerCatalogTest = Livewire::test(DockerCatalog::class);
|
||||
$livewireCatalogIndex = $dockerCatalogTest->set('keyword', $dockerImage)
|
||||
->assertSee($dockerImage);
|
||||
|
||||
$viewData = $livewireCatalogIndex->viewData('dockerImages');
|
||||
$this->assertNotEmpty($viewData);
|
||||
|
@ -39,6 +42,24 @@ class DockerTest extends TestCase
|
|||
$livewireCatalogIndex->set('keyword', 'non-existing-image')
|
||||
->assertDontSee('non-existing-image');
|
||||
|
||||
$pullDockerImage = $dockerCatalogTest->call('pullDockerImage', $dockerImage)
|
||||
->assertSee('Pull Docker Image');
|
||||
|
||||
$isDokerImagePulled = false;
|
||||
$pullLog = '';
|
||||
for ($i = 0; $i < 300; $i++) {
|
||||
$pullLog = @file_get_contents($pullDockerImage->get('pullLogFile'));
|
||||
if (strpos($pullLog, 'DONE!') !== false) {
|
||||
$isDokerImagePulled = true;
|
||||
break;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
$this->assertTrue($isDokerImagePulled);
|
||||
|
||||
$this->assertNotEmpty($pullLog);
|
||||
$this->assertStringContainsString('DONE!', $pullLog);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue