Skip to content

Commit 965c9c7

Browse files
icewind1991backportbot[bot]
authored andcommitted
test: retry smb notify test a few times
Signed-off-by: Robin Appelman <[email protected]>
1 parent fc979cf commit 965c9c7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

apps/files_external/tests/Storage/SmbTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use OC\Files\Notify\RenameChange;
3434
use OCA\Files_External\Lib\Storage\SMB;
3535
use OCP\Files\Notify\IChange;
36+
use PHPUnit\Framework\ExpectationFailedException;
3637

3738
/**
3839
* Class SmbTest
@@ -96,6 +97,22 @@ public function testStorageId() {
9697
}
9798

9899
public function testNotifyGetChanges() {
100+
$lastError = null;
101+
for($i = 0; $i < 5; $i++) {
102+
try {
103+
$this->tryTestNotifyGetChanges();
104+
return;
105+
} catch (ExpectationFailedException $e) {
106+
$lastError = $e;
107+
$this->tearDown();
108+
$this->setUp();
109+
sleep(1);
110+
}
111+
}
112+
throw $lastError;
113+
}
114+
115+
private function tryTestNotifyGetChanges(): void {
99116
$notifyHandler = $this->instance->notify('');
100117
sleep(1); //give time for the notify to start
101118
$this->instance->file_put_contents('/newfile.txt', 'test content');

0 commit comments

Comments
 (0)