Commit graph

26 commits

Author SHA1 Message Date
Lin Jen-Shin
4587c78afa Merge remote-tracking branch 'upstream/master' into fix-git-hooks-when-creating-file
* upstream/master: (1122 commits)
  Update CHANGELOG.md for 8.16.2
  Display project ID in project settings (!8572)
  fixed points from comments to improve code quality
  Update CHANGELOG.md for 8.14.8
  Statisfy eslint
  Add CHANGELOG entry
  Fix access to the wiki code via HTTP when repository feature disabled
  Display fullscreen button on small screens (!5302)
  Prevent removing fields from dropdowns on input elements
  fix for all themes
  Return struct instead of multiple values
  Fix race conditions for AuthorizedProjectsWorker
  Add User#nested_groups and User#nested_projects methods
  Fix spec failure due to timestamp ordering issue in mySQL
  Fixed error with filter keyboard tests
  `can?` already includes the `feature_available?` check
  Test there is no Merge Request button when MRs are disabled
  Ensure the correct Merge Request button is found
  Add 409 conflict tests
  Add CHANGELOG
  ...
2017-01-26 17:21:38 +08:00
James Lopez
69ecd951a9 refactor fetcher and fixed specs 2017-01-17 11:32:55 +01:00
James Lopez
e4e313fcca Fix other spec failures 2017-01-17 11:32:55 +01:00
James Lopez
a67311cb4c Fix other spec failures 2017-01-17 11:32:55 +01:00
James Lopez
02e1e48192 more refactoring and fixing old specs 2017-01-17 11:32:54 +01:00
Lin Jen-Shin
07b9b80a88 Fix tests to use the new API 2016-12-08 19:11:52 +08:00
Douwe Maan
6d37fe952b Merge branch 'jej-fix-missing-access-check-on-issues' into 'security'
Fix missing access checks on issue lookup using IssuableFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

⚠️ - Potentially untested
💣 - No test coverage
🚥 - Test coverage of some sort exists (a test failed when error raised)
🚦 - Test coverage of return value (a test failed when nil used)
 - Permissions check tested

- [x]  app/controllers/projects/branches_controller.rb:39
  - `before_action :authorize_push_code!` helpes limit/prevent exploitation. Always checks for reporter access so fine with
    confidential issues, issues only visible to team, etc.
- [x] 🚥 app/models/cycle_analytics/summary.rb:9 [`.count`]
- [x]  app/controllers/projects/todos_controller.rb:19

- [x] Potential double render in app/controllers/projects/todos_controller.rb

- https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#cedccb227af9bfdf88802767cb58d43c2b977439_24_24

See merge request !2030
2016-11-28 21:25:46 -03:00
James Lopez
42ba19f339 fixed newline 2016-10-12 14:30:49 +02:00
James Lopez
2b37f040b6 Ignore deployment for statistics in Cycle Analytics, except in staging and production stages
Also, updated specs and docs.
2016-10-12 12:32:25 +02:00
Timothy Andrew
c0ecef79fe Fix the "Commits" section of the cycle analytics summary.
- 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.
2016-09-26 18:38:40 +05:30
Timothy Andrew
918e589c2b Implement a second round of review comments from @DouweM.
- 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.
2016-09-21 00:47:37 +05:30
Timothy Andrew
231a9f5b87 Fix rubocop spec.
And `scss_lint`
2016-09-20 18:26:31 +05:30
Timothy Andrew
d0e101e997 Fix all cycle analytics specs.
A number of failures were introduced due to performance
improvements (like pre-calculating metrics).
2016-09-20 13:23:14 +05:30
Timothy Andrew
204419e9e9 Test the CycleAnalytics::Summary model. 2016-09-20 13:23:14 +05:30
Timothy Andrew
0a767f7b61 Consolidate all cycle analytics helper methods.
1. Move the test generation to `CycleAnalyticsHelpers::TestGeneration`

2. Move all helper methods (previously placed in each individual spec
   file) to `CycleAnalyticsHelpers`
2016-09-07 14:29:12 +05:30
Timothy Andrew
9cff3f8f52 Test the test cycle analytics phase. 2016-09-07 14:11:24 +05:30
Timothy Andrew
de483c6834 Test the production cycle analytics phase.
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.
2016-09-07 13:06:58 +05:30
Timothy Andrew
dd112ef117 Test the staging cycle analytics phase.
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`.
2016-09-07 12:12:51 +05:30
Timothy Andrew
0f44c5a56f Generate branch/file names more randomly to avoid failures.
- Tests would randomly fail because of naming conflicts.
- Use a `random_git_name` method instead of using `FFaker` directly.
2016-09-07 11:26:07 +05:30
Timothy Andrew
71a9bcd3de Test the 'review' cycle analytics phase. 2016-09-07 11:25:50 +05:30
Timothy Andrew
f77c952ae7 Test the code cycle analytics phase.
- Move the "data belongs to other project" test case into the generated
  tests, and remove the explicit tests from the `code` and `plan` phases.
2016-09-07 10:39:46 +05:30
Timothy Andrew
98c9d12077 Refactor cycle analytics specs.
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.
2016-09-02 17:43:03 +05:30
Timothy Andrew
0f74860594 Add tests for the plan cycle analytics phase.
Clean up the `issue` tests as well
2016-09-02 12:19:40 +05:30
Timothy Andrew
331080bca6 Fetch cycle analytics data for a specific date range.
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.
2016-08-26 16:28:20 +05:30
Timothy Andrew
df6c9c33b6 Scope Cycle Analytics queries to a project 2016-08-26 16:28:20 +05:30
Timothy Andrew
a81de9ab4f Add a spec for the CycleAnalytics#issue method. 2016-08-26 16:28:20 +05:30