Skip to content

Commit

Permalink
test: retry smb notify test a few times
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and joshtrichards committed May 6, 2024
1 parent afe8b9b commit 5838d61
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/files_external/tests/Storage/SmbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OC\Files\Notify\RenameChange;
use OCA\Files_External\Lib\Storage\SMB;
use OCP\Files\Notify\IChange;
use PHPUnit\Framework\ExpectationFailedException;

/**
* Class SmbTest
Expand Down Expand Up @@ -96,6 +97,22 @@ public function testStorageId() {
}

public function testNotifyGetChanges() {
$lastError = null;
for($i = 0; $i < 5; $i++) {
try {
$this->tryTestNotifyGetChanges();
return;
} catch (ExpectationFailedException $e) {
$lastError = $e;
$this->tearDown();
$this->setUp();
sleep(1);
}
}
throw $lastError;
}

private function tryTestNotifyGetChanges(): void {
$notifyHandler = $this->instance->notify('');
sleep(1); //give time for the notify to start
$this->instance->file_put_contents('/newfile.txt', 'test content');
Expand Down

0 comments on commit 5838d61

Please sign in to comment.