summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-05-11 14:01:05 +0200
committerRoeland Jago Douma <rullzer@owncloud.com>2016-05-11 14:57:06 +0200
commit2be7290002a731b40fb49893c7f9f1c0351854a0 (patch)
tree765de50206f5e725a84990b3e49e6a1dc2fc297e /apps
parent1686d809fa71897670f7a373cfe09b99fb1f67fa (diff)
downloadnextcloud-server-2be7290002a731b40fb49893c7f9f1c0351854a0.tar.gz
nextcloud-server-2be7290002a731b40fb49893c7f9f1c0351854a0.zip
Fix test race condition
E-tag propagation replies on the mtime of the file. Order of events: 1. add file 'foo.txt' with content 'bar' 2. Set mtime to now() - 1 3. Check if etag changed. Now this goes right often when 1 and 2 happen in the same second. However imagine 1. add file 'foo.txt' with content 'bar' (at t=0.999) 2. Set mtime to now() - 1 (at t=1.001) Now the mtime will be set to the same time. Thus not chaning the etag.
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/tests/etagpropagation.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/etagpropagation.php b/apps/files_sharing/tests/etagpropagation.php
index 8da4e6f29bd..19db511f335 100644
--- a/apps/files_sharing/tests/etagpropagation.php
+++ b/apps/files_sharing/tests/etagpropagation.php
@@ -187,6 +187,8 @@ class EtagPropagation extends TestCase {
public function testOwnerWritesToSingleFileShare() {
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
Filesystem::file_put_contents('/foo.txt', 'bar');
+ $t = (int)Filesystem::filemtime('/foo.txt') - 1;
+ Filesystem::touch('/foo.txt', $t);
$this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER3]);
$this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2]);