summaryrefslogtreecommitdiff
path: root/spec/models
Commit message (Collapse)AuthorAgeFilesLines
* Improve how MergeCommit#merge_commit_message builds the messageRobert Speicher2016-09-271-0/+36
| | | | | | | | | | | | | | | Now a merge request with a blank description will no longer produce a merge commit message like this: ``` Merge branch 'foo' into 'master' Bring the wonders of foo into the world See merge request !7283 ``` What an improvement! :tada:
* Fix the "Commits" section of the cycle analytics summary.Timothy Andrew2016-09-261-0/+6
| | | | | | | | | - The commit count was capped at 10, due to `Gitlab::Git::Repository#log` enforcing a limit, with the default set to 10. - Reimplement a small portion of this `log` function to get just the data we need.
* added more specsJames Lopez2016-09-261-0/+16
|
* Ensure milestones passed to GlobalMilestone is an ActiveRecord::RelationAhmad Sherif2016-09-231-2/+3
|
* Add test for MergeRequestDiff#commits_sha, feedback:Lin Jen-Shin2016-09-221-0/+22
| | | | https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6470#note_15856755
* For empty merge_request_diff st_commits would be nilfix-pipeline-for-empty-merge-request-diffLin Jen-Shin2016-09-221-6/+21
| | | | Closes #22438
* Merge branch 'and-you-get-awards' into 'master' Rémy Coutable2016-09-211-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And Snippets get awards ## What does this MR do? Makes snippets more awesome, by making them awardables ## Why was this MR needed? Because Snippets were left behind. ## What are the relevant issue numbers? Closes #17878 See merge request !4456
| * Snippets get award emoji! :thumbsup:Z.J. van de Weg2016-09-191-0/+2
| |
* | Merge branch 'rs-simplify-fetch_members' into 'master' Rémy Coutable2016-09-211-0/+62
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplify ProjectTeam#fetch_members to satisfy flog ## What does this MR do? - Add specs for ProjectTeam#fetch_members - Simplify ProjectTeam#fetch_members to satisfy flog ## What are the relevant issue numbers? Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22200 See merge request !6431
| * | Fix a logic error in ProjectTeam#fetch_invited_membersRobert Speicher2016-09-201-0/+1
| | | | | | | | | | | | | | | | | | We were calling `.where` and `.send` on the relation, but never doing anything with the return value, resulting in proper access-level filtering never being of any consequence.
| * | Add specs for ProjectTeam#fetch_membersRobert Speicher2016-09-201-0/+61
| | |
* | | Merge branch 'show-all-pipelines-from-all-diffs' into 'master' Rémy Coutable2016-09-211-6/+53
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Show all pipelines from all merge_request_diffs This way we could also show pipelines from commits which were discarded due to a force push. Closes #21889 See merge request !6414
| * | | Use factory instead of using new directly. Feedback:show-all-pipelines-from-all-diffsLin Jen-Shin2016-09-211-9/+2
| | | | | | | | | | | | | | | | https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6414#note_15765156
| * | | Add a test for non-persisted merge requestLin Jen-Shin2016-09-201-0/+22
| | | |
| * | | Test against MergeRequest#all_commits_sha, feedback:Lin Jen-Shin2016-09-201-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6414#note_15750344 So that we could just use it in testing for MergeRequest#all_pipelines
| * | | Show all pipelines from all merge_request_diffs:Lin Jen-Shin2016-09-191-6/+25
| | | | | | | | | | | | | | | | | | | | This way we could also show pipelines from commits which were discarded due to a force push.
* | | | Improve specsKamil Trzcinski2016-09-212-4/+5
| | | |
* | | | Add tests to verify the correctness of returned environmentsKamil Trzcinski2016-09-212-6/+87
| | | |
* | | | Merge branch '21170-cycle-analytics' into 'master' Stan Hu2016-09-2111-0/+572
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cycle Analytics: first iteration ## What does this MR do? - Implement the first iteration of the "Cycle Analytics" feature. ## What are the relevant issue numbers? - Closes #21170 ## Screenshots ![cycle_analytics_screencast.gif](/uploads/d23c3c912caa6935fd47b53ca3a56b97/cycle_analytics.gif) ## Backend Tasks - [x] Implementation - [x] Phases - [x] Issue (Tracker) - [x] Plan (Board) - [x] Code (IDE) - [x] Test (CI) - [x] Review (MR) - [x] Staging (CD) - [x] Production (Total) - [x] Make heuristics more modular - [x] Scope to project - [x] Date range (30 days, 90 days) - [x] Access restriction - [x] Test - [x] Find a better way to test these phases - [x] Phases - [x] Issue (Tracker) - [x] Plan (Board) - [x] Code (IDE) - [x] Test (CI) - [x] Review (MR) - [x] Staging (CD) - [x] Production (Total) - [x] Test for "end case happens before start case" - [x] Consolidate helper - [x] Miniboss review - [x] Performance testing with mock data - [x] Improve performance - [x] Pre-calculate "merge requests closing issues - [x] Pre-calculate everything else - [x] Test performance against 10k issues - [x] Test all pre-calculation code - [x] Ci::Pipeline -> build start/finish - [x] Ci::Pipeline#merge_requests - [x] Issue -> record default metrics after save - [x] MergeRequest -> record default metrics after save - [x] Deployment -> Update "first_deployed_to_production_at" for MR metrics - [x] Git Push -> Update "first commit mention" for issue metrics - [x] Merge request create/update/refresh -> Update "merge requests closing issues" - [x] Remove `MergeRequestsClosingIssues` when necessary - [x] Changes to unblock Fatih - [x] Add summary data - [x] `stats` should be array - [x] Let `stats` be `null` if all `stats` are null - [x] Indexes for "merge requests closing issues" - [x] Test summary data - [x] Scope everything to project - [x] Find out why tests were passing - [x] Filter should include issues/MRs which have made it to production within the range - [x] Don't create duplicate `MergeRequestsClosingIssues` - [x] Fix tests - [x] MySQL median - [x] Assign to Douwe for review - [x] Fix conflicts - [x] Implement suggestions from Yorick's review - [x] Test on PG - [x] Test on MySQL - [x] Refactor - [x] Cleanup - [x] What happens if we have no data at all? - [x] Extract common queries to methods / scopes - [x] Remove unused queries - [x] Downtime for foreign key migrations - [x] Find a way around "if issue.metrics.present?" all over the place - [x] Find a way around "if merge_request.metrics.present?" all over the place - [x] Test migrations on a fresh database - [x] MySQL - [x] Pg - [x] Access issues - While the project is public and the visibility is set to "Everyone with access", you cannot visit the cycle analytics page when signed out. - [x] CHANGELOG - [x] Implement suggestions from Douwe's review - [x] First set of comments - [x] Second set of comments - [x] Third set of comments - [x] Fourth set of comments - [x] Make sure build is green - [ ] Make issue for "polish" - [ ] EE MR See merge request !5986
| * | | | Fix build.Timothy Andrew2016-09-211-3/+3
| | | | |
| * | | | Implement a second round of review comments from @DouweM.Timothy Andrew2016-09-217-87/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't use `TableReferences` - using `.arel_table` is shorter! - Move some database-related code to `Gitlab::Database` - Remove the `MergeRequest#issues_closed` and `Issue#closed_by_merge_requests` associations. They were either shadowing or were too similar to existing methods. They are not being used anywhere, so it's better to remove them to reduce confusion. - Use Rails 3-style validations - Index for `MergeRequest::Metrics#first_deployed_to_production_at` - Only include `CycleAnalyticsHelpers::TestGeneration` for specs that need it. - Other minor refactorings.
| * | | | Fix rubocop spec.Timothy Andrew2016-09-201-2/+6
| | | | | | | | | | | | | | | | | | | | And `scss_lint`
| * | | | Fix spec failures.Timothy Andrew2016-09-203-7/+7
| | | | |
| * | | | Merge remote-tracking branch 'origin/master' into 21170-cycle-analyticsTimothy Andrew2016-09-2042-680/+838
| |\ \ \ \ | | | |/ / | | |/| |
| * | | | Fix all cycle analytics specs.Timothy Andrew2016-09-205-9/+61
| | | | | | | | | | | | | | | | | | | | | | | | | A number of failures were introduced due to performance improvements (like pre-calculating metrics).
| * | | | Test the `CycleAnalytics::Summary` model.Timothy Andrew2016-09-201-0/+53
| | | | |
| * | | | Test all cycle analytics pre-calculation code.Timothy Andrew2016-09-193-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the code that pre-calculates metrics for use in the cycle analytics page. - Ci::Pipeline -> build start/finish - Ci::Pipeline#merge_requests - Issue -> record default metrics after save - MergeRequest -> record default metrics after save - Deployment -> Update "first_deployed_to_production_at" for MR metrics - Git Push -> Update "first commit mention" for issue metrics - Merge request create/update/refresh -> Update "merge requests closing issues"
| * | | | Merge remote-tracking branch 'origin/master' into 21170-cycle-analyticsTimothy Andrew2016-09-0715-230/+403
| |\ \ \ \
| * | | | | Consolidate all cycle analytics helper methods.Timothy Andrew2016-09-076-123/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Move the test generation to `CycleAnalyticsHelpers::TestGeneration` 2. Move all helper methods (previously placed in each individual spec file) to `CycleAnalyticsHelpers`
| * | | | | Test the `test` cycle analytics phase.Timothy Andrew2016-09-071-0/+90
| | | | | |
| * | | | | Test the `production` cycle analytics phase.Timothy Andrew2016-09-071-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a `before_end_fn` option to the code that generates cycle analytics specs. `before_end_fn` is called before the end conditions are. Used for data setup that needs to be called after the start conditions and before the end conditions.
| * | | | | Test the `staging` cycle analytics phase.Timothy Andrew2016-09-071-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove overlap from the "start + end" durations in the happy test case. For the `staging` phase, the end time is the _first_ deployment that happens after the MR merge. If we have 5 MRs where the `start_time`s (merge time) are the same, and all the `end_time`s (deploy to production) a few days from now, only the earliest deploy will get picked up, because that consitutes a deploy for _all_ the MRs. We fix this by removing overlap. Every `start_time` is now generated to be _after_ the preceding `end_time`.
| * | | | | Generate branch/file names more randomly to avoid failures.Timothy Andrew2016-09-073-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Tests would randomly fail because of naming conflicts. - Use a `random_git_name` method instead of using `FFaker` directly.
| * | | | | Test the 'review' cycle analytics phase.Timothy Andrew2016-09-071-0/+45
| | | | | |
| * | | | | Test the `code` cycle analytics phase.Timothy Andrew2016-09-073-25/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move the "data belongs to other project" test case into the generated tests, and remove the explicit tests from the `code` and `plan` phases.
| * | | | | Refactor cycle analytics specs.Timothy Andrew2016-09-022-180/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Generalise the specs that will be common across all cycle analytics phases. 2. Rewrite specs `issue` and `plan` to use this abstracted testing strategy. 3. Specs that are specific to a given phase, or unwieldy to test in an abstracted manner, are added to each phase's spec.
| * | | | | Add tests for the `plan` cycle analytics phase.Timothy Andrew2016-09-022-63/+188
| | | | | | | | | | | | | | | | | | | | | | | | Clean up the `issue` tests as well
| * | | | | Fetch cycle analytics data for a specific date range.Timothy Andrew2016-08-261-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Supported date ranges are 30 / 90 days ago. The default is 90 days ago. 2. All issues created before "x days ago" are filtered out, even if they have other related data (test runs, merge requests) within the filter range.
| * | | | | Scope Cycle Analytics queries to a projectTimothy Andrew2016-08-261-8/+13
| | | | | |
| * | | | | Add a spec for the `CycleAnalytics#issue` method.Timothy Andrew2016-08-261-0/+80
| | | | | |
* | | | | | Merge branch 'add_optional_author_for_commits' into 'master' Rémy Coutable2016-09-201-2/+134
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add optional 'author' param when making commits This fulfills https://gitlab.com/gitlab-org/gitlab-ce/issues/20789 by adding the ability to specify a user's ID to be used as the author of a commit. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/20789 See merge request !5822
| * | | | | Add optional 'author' param when making commitsDan Dunckel2016-09-191-2/+134
| | |_|_|/ | |/| | |
* | | | | Fix broken spec due to last_activity_at updates being throttledStan Hu2016-09-191-5/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | In https://gitlab.com/gitlab-org/gitlab-ce/builds/4218398, the build failed because the last_activity_at column was only being updated once per hour. We can fix this spec by stubbing out the throttling and adjusting the spec to test the right event timestamp.
* | | | Merge branch 'throttle-last-activity-at' into 'master' Rémy Coutable2016-09-191-10/+33
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | Restrict last_activity_at updates to one per hour This MR reduces the number of updates to `projects.last_activity_at` to once per hour. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22213 See merge request !6391
| * | | Restrict last_activity_at updates to one per hourYorick Peterse2016-09-191-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The lock in turn is only obtained when actually needed, reducing some load on Redis. Fixes gitlab-org/gitlab-ce#22213
* | | | Merge branch 'master' into per-build-tokenKamil Trzcinski2016-09-1930-518/+143
|\ \ \ \ | |/ / /
| * | | Fix validation regexs (+1 squashed commit)Kamil Trzcinski2016-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | Squashed commits: [f9a9315] Use : to test invalid environment name
| * | | Verify expandability of variables defined as part of environmentKamil Trzcinski2016-09-191-0/+16
| | | |
| * | | Merge branch ↵Stan Hu2016-09-161-6/+14
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '22246-actionview-template-error-undefined-method-each-for-nil-nilclass' into 'master' MergeRequest#environments now returns an empty array when diff_head_commit is nil ## Does this MR meet the acceptance criteria? - [x] No CHANGELOG needed for a bug introduced in an RC. - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] 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 #22246 See merge request !6379
| | * | | MergeRequest#environments now returns an empty array when diff_head_commit ↵22246-actionview-template-error-undefined-method-each-for-nil-nilclassRémy Coutable2016-09-161-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is nil Signed-off-by: Rémy Coutable <remy@rymai.me>