summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-05-02 11:30:53 +0200
committerGitHub <noreply@github.com>2024-05-02 11:30:53 +0200
commitf883d804696147eeea18bf61ae8ec8abad5a6810 (patch)
treea583a1960f446ecc4466b9611ed2a99f79700c46
parente5f5f06b1b6ad0a49b540a4053419385aa19d02e (diff)
parent13fe1e26cad2060219e6e177d324b415cb4ea7b7 (diff)
Merge pull request #45138 from nextcloud/smb-notify-test-retry
-rw-r--r--apps/files_external/tests/Storage/SmbTest.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php
index 6d21f696683..33377687361 100644
--- a/apps/files_external/tests/Storage/SmbTest.php
+++ b/apps/files_external/tests/Storage/SmbTest.php
@@ -33,6 +33,7 @@ use OC\Files\Notify\Change;
use OC\Files\Notify\RenameChange;
use OCA\Files_External\Lib\Storage\SMB;
use OCP\Files\Notify\IChange;
+use PHPUnit\Framework\ExpectationFailedException;
/**
* Class SmbTest
@@ -96,6 +97,22 @@ class SmbTest extends \Test\Files\Storage\Storage {
}
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');