summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-09-13 01:51:51 +0000
committerStan Hu <stanhu@gmail.com>2016-09-13 01:51:51 +0000
commit6b88cc6469a08db12aee8f5b0f8ef581bd491265 (patch)
treee0b299fab313b2c5bd28ed514abeb4e513e6dbda
parent0a250cf9eb317c9f94dedc40b2dea9510e74fe09 (diff)
parentb7814205dc3aed8e1f405c43a63e376fec726112 (diff)
downloadgitlab-ce-6b88cc6469a08db12aee8f5b0f8ef581bd491265.tar.gz
Merge branch '22057-fix-api-ossues-sorting-flaky-specs' into 'master'
Ensure specs on sorting of issues in API are deterministic on MySQL ## What does this MR do? Ensure a deterministic order of issues on the existing API issues specs ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? To avoid random failures as described on #22057 ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - ~~[ ] API support added~~ - Tests - ~~[ ] Added for this feature/bug~~ - [ ] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Closes #22057 See merge request !6306
-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 fe91044a593..d69168985cd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,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
- Fix file permissions change when updating a file on the Gitlab UI !5979
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