summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-09-12 15:11:49 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-09-12 15:44:41 +0200
commitb7814205dc3aed8e1f405c43a63e376fec726112 (patch)
treeb99638d81b366c4925c4b606a83a95f0db50874b
parent45afdbef0de58f6de207b057e47151611d2ad7e6 (diff)
downloadgitlab-ce-22057-fix-api-ossues-sorting-flaky-specs.tar.gz
Ensure specs on sorting of issues in API are deterministic on MySQL22057-fix-api-ossues-sorting-flaky-specs
MySQL could not have support for millisecond precision, depends on the MySQL version so we just create issues in different seconds in a deterministic way
-rw-r--r--CHANGELOG1
-rw-r--r--spec/factories/issues.rb4
-rw-r--r--spec/requests/api/issues_spec.rb3
3 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 132122d460d..e785484b70f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,6 +18,7 @@ v 8.12.0 (unreleased)
- Use Search::GlobalService.new in the `GET /projects/search/:query` endpoint
- Fix pagination on user snippets page
- Fix sorting of issues in API
+ - Ensure specs on sorting of issues in API are deterministic on MySQL
- Escape search term before passing it to Regexp.new !6241 (winniehell)
- Fix pinned sidebar behavior in smaller viewports !6169
- Change merge_error column from string to text type
diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb
index 2c0a2dd94ca..2b4670be468 100644
--- a/spec/factories/issues.rb
+++ b/spec/factories/issues.rb
@@ -1,4 +1,8 @@
FactoryGirl.define do
+ sequence :issue_created_at do |n|
+ 4.hours.ago + ( 2 * n ).seconds
+ end
+
factory :issue do
title
author
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index 86d994be079..f840778ae9b 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -18,6 +18,7 @@ describe API::API, api: true do
project: project,
state: :closed,
milestone: milestone,
+ created_at: generate(:issue_created_at),
updated_at: 3.hours.ago
end
let!(:confidential_issue) do
@@ -26,6 +27,7 @@ describe API::API, api: true do
project: project,
author: author,
assignee: assignee,
+ created_at: generate(:issue_created_at),
updated_at: 2.hours.ago
end
let!(:issue) do
@@ -34,6 +36,7 @@ describe API::API, api: true do
assignee: user,
project: project,
milestone: milestone,
+ created_at: generate(:issue_created_at),
updated_at: 1.hour.ago
end
let!(:label) do