jenkins-bot has submitted this change and it was merged.

Change subject: Fix intermittent off by one issues
......................................................................


Fix intermittent off by one issues

I'm certain this fixed the problem in UUIDTest.

The api i'm mostly sure but the test is too slow to repeat locally and
trigger the error. The topiclist is sorted by the topic ids (postId of
the topic) so checking against revisionId is an obvious potential
off-by-one issue.

Bug: T75833
Change-Id: I8b61ffa46776846771e33300181e9ec8aebafe78
---
M tests/phpunit/Model/UUIDTest.php
M tests/phpunit/api/ApiFlowViewTopicListTest.php
2 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/Model/UUIDTest.php b/tests/phpunit/Model/UUIDTest.php
index 7923985..d6ad604 100644
--- a/tests/phpunit/Model/UUIDTest.php
+++ b/tests/phpunit/Model/UUIDTest.php
@@ -156,7 +156,6 @@
        }
 
        public function testConversionToTimestamp() {
-               // @todo assert now +-1?
-               $this->assertEquals( wfTimestampNow(), 
UUID::create()->getTimestamp() );
+               $this->assertEquals( '20150303221220', UUID::create( 
'scv3pvbt40kcyy4g' )->getTimestamp() );
        }
 }
diff --git a/tests/phpunit/api/ApiFlowViewTopicListTest.php 
b/tests/phpunit/api/ApiFlowViewTopicListTest.php
index 53bb8f1..80a8d7f 100644
--- a/tests/phpunit/api/ApiFlowViewTopicListTest.php
+++ b/tests/phpunit/api/ApiFlowViewTopicListTest.php
@@ -2,6 +2,7 @@
 
 namespace Flow\Tests\Api;
 
+use Flow\Model\UUID;
 use Title;
 
 /**
@@ -187,7 +188,7 @@
                        $responseTopic = 
$replyResponse['flow']['reply']['result']['topic'];
                        $topicRevisionId = 
$topicData[$topicDataInd]['revisionId'];
                        $newPostId = end( 
$responseTopic['revisions'][$topicRevisionId]['replies'] );
-                       $topicData[$topicDataInd]['updateTimestamp'] = 
$responseTopic['revisions'][$newPostId]['timestamp'];
+                       $topicData[$topicDataInd]['updateTimestamp'] = 
UUID::create( $newPostId )->getTimestamp();
                        
$topicData[$topicDataInd]['expectedRevision']['last_updated'] = wfTimestamp( 
TS_UNIX, $topicData[$topicDataInd]['updateTimestamp'] ) * 1000;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/194226
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8b61ffa46776846771e33300181e9ec8aebafe78
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to