summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Migrate down before each migration unit testbackstage/gb/migrations-tests-schema-versionGrzegorz Bizon2017-08-171-1/+1
| | | | | | | | | | `migrate!` helper triggers a migration that is under the test, so we need to revert it before each subsequent example. This means that we need to place it in `before(:each, :migration)` hook. We still want to migrate everything up *after* each *context*, so in otherwords we need to place migrate up helper in `before(:context, :migration)`.
* Make it possible to provide schema version in testsGrzegorz Bizon2017-08-161-8/+3
|
* Migrate db schema for context in :migration specsGrzegorz Bizon2017-08-161-2/+2
|
* Merge branch '35804-document-table-based-tests' into 'master'Robert Speicher2017-08-141-0/+1
|\ | | | | | | | | | | | | Use rspec-parameterized for table-based tests Closes #35804 See merge request !13469
| * Use rspec-parameterized for table-based testsNick Thomas2017-08-111-0/+1
| |
* | Merge branch '32004-use-timecop-safe-mode' into 'master'Robert Speicher2017-08-111-0/+1
|\ \ | | | | | | | | | | | | | | | | | | Enable Timecop safe mode Closes #32004 See merge request !13498
| * | Enable Timecop safe mode32004-use-timecop-safe-modeRémy Coutable2017-08-111-0/+1
| |/ | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Use a new RspecFlakyListener to detect flaky specsRémy Coutable2017-08-111-6/+6
|/ | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Reset only migration models36052-reset-only-migration-modelsLin Jen-Shin2017-08-071-2/+2
| | | | | | | | | | | | | | | | | So that we could make sure migration tests could run even if geo is not setup in EE. This is because we have a model like this: ``` ruby class Geo::BaseRegistry < ActiveRecord::Base def self.connection raise 'Geo secondary database is not configured' unless Gitlab::Geo.geo_database_configured? super end end ```
* Don't send rejection mails for all auto-generated mails28472-ignore-auto-generated-mailsLin Jen-Shin2017-08-031-1/+5
| | | | Also make it easier to have mailer helper
* Remove events column from notification settings33620-remove-events-from-notification_settingsSean McGivern2017-07-311-0/+4
| | | | | This was migrated to separate columns in 9.4, and now just needs to be removed for real.
* Ensure Gitlab::Application.routes.default_url_options are set correctly in ↵Rémy Coutable2017-07-281-0/+1
| | | | | | Capybara + :js specs Signed-off-by: Rémy Coutable <remy@rymai.me>
* Update shoulda-matchers gem to 3.1.2Dmitriy Zaporozhets2017-07-241-0/+7
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Update Prometheus gem to version that explicitly calls `munmap`Paweł Chojnacki2017-07-191-1/+0
|
* Enable all feature flags by default in specsbvl-enable-features-in-testBob Van Landuyt2017-07-131-0/+3
| | | | | | | | | Otherwise some features would go untested in non-specific contexts I did need to disable the `gitlab_git_diff_size_limit_increase`-feature in some specs since we depend on diffs being expandable while the file we are testing on is smaller than the increased limit.
* Replace 'browse_files.feature' spinach test with an rspec analogblackst0ne2017-07-121-0/+5
|
* Support multiple Redis instances based on queue typePaul Charlton2017-07-111-5/+15
|
* Include new URL helpers retroactively into includers of Gitlab::Routingdm-fix-project-path-helpers-productionDouwe Maan2017-07-071-1/+1
|
* Create and use project path helpers that only need a project, no namespaceDouwe Maan2017-07-051-1/+1
|
* Include Devise::Test::IntegrationHelpers for all feature specsRobert Speicher2017-06-191-0/+1
|
* Make spec/spec_helper consistent with EE by including a :routing typesh-fix-spec-helper-ee-consistencyStan Hu2017-06-141-0/+1
|
* Fix migrations testing support RSpec hooks orderfix/gb/fix-migrations-testing-support-hooks-orderGrzegorz Bizon2017-06-131-9/+7
|
* Merge branch 'retry-specs' into 'master'Robert Speicher2017-06-121-3/+2
|\ | | | | | | | | Attempts to run RSpec tests twice (1 retry) See merge request !12066
| * Attempts to run RSpec tests twice (1 retry)retry-specsRémy Coutable2017-06-121-3/+2
| | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Use :request_store hooks on specsuse-request-store-helper-instead-actual-codeOswaldo Ferreira2017-06-091-0/+9
|/
* Merge branch 'feature/gb/migrate-pipeline-stages' into 'master'Kamil Trzciński2017-06-071-0/+12
|\ | | | | | | | | Migrate pipeline stages in the database See merge request !11714
| * Merge branch 'master' into feature/gb/migrate-pipeline-stagesGrzegorz Bizon2017-06-051-0/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (524 commits) Improve user experience around slash commands in instant comments Fix LFS timeouts when trying to save large files retryable? is now available for CommitStatus Resolve "Documentation of `.gitlab-ci.yml` states incorrect example for variables" Fix test failures Add slugify project path to CI enviroment variables Fixed typo: craeted -> created 32118 Make New environment empty state btn lowercase Expose import_status in Projects API 32832 Remove overflow from comment form for confidential issues and vertically aligns confidential issue icon Fix test failures Allow manual bypass of auto_sign_in_with_provider Fix keys seed Allow users to be hard-deleted from the API fixup some classnames and media queries Enable the Style/PreferredHashMethods cop Lint our factories creation in addition to their build Don’t schedule workers from inside transactions Allow scheduling from after_commit hooks Forbid Sidekiq scheduling in transactions ... Conflicts: db/schema.rb spec/spec_helper.rb
| * | Calculate previous migration version in specs supportGrzegorz Bizon2017-06-051-3/+3
| | | | | | | | | | | | | | | | | | This makes it possible to test migration on the schema this migration was written for, without a need to specify a previous schema version manually.
| * | Reorder pipeline stages-related migrationsGrzegorz Bizon2017-05-261-5/+7
| | |
| * | Add pipeline stages post deployment migrationGrzegorz Bizon2017-05-261-2/+2
| | |
| * | Add migrations helpers to simplify writing migration specsGrzegorz Bizon2017-05-261-3/+3
| | |
| * | Make migration specs by using migrator in around hookGrzegorz Bizon2017-05-261-1/+1
| | |
| * | Simplify migrations for specific database schemaGrzegorz Bizon2017-05-251-0/+10
| | |
* | | Move Prometheus presentation logic to PrometheusTextPawel Chojnacki2017-06-021-0/+1
| |/ |/| | | | | | | | | | | | | + Use NullMetrics to mock metrics when unused + Use method_missing in NullMetrics mocking + Update prometheus gem to version that correctly uses transitive dependencies + Ensure correct folders are used in Multiprocess prometheus client tests. + rename Sessions controller's metric
* | Move rainbow monkey patch to String to spec_helperGabriel Mazetto2017-05-311-0/+3
| |
* | Merge branch 'rework-authorizations-performance' into 'master'Douwe Maan2017-05-291-0/+8
|\ \ | |/ |/| | | | | Rework project authorizations and nested groups for better performance See merge request !10885
| * Hide nested group UI/API support for MySQLYorick Peterse2017-05-171-1/+1
| | | | | | | | | | | | This hides/disables some UI elements and API parameters related to nested groups when MySQL is used, since nested groups are not supported for MySQL.
| * Use CTEs for nested groups and authorizationsYorick Peterse2017-05-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the usage of Common Table Expressions (CTEs) to efficiently retrieve nested group hierarchies, without having to rely on the "routes" table (which is an _incredibly_ inefficient way of getting the data). This requires a patch to ActiveRecord (found in the added initializer) to work properly as ActiveRecord doesn't support WITH statements properly out of the box. Unfortunately MySQL provides no efficient way of getting nested groups. For example, the old routes setup could easily take 5-10 seconds depending on the amount of "routes" in a database. Providing vastly different logic for both MySQL and PostgreSQL will negatively impact the development process. Because of this the various nested groups related methods return empty relations when used in combination with MySQL. For project authorizations the logic is split up into two classes: * Gitlab::ProjectAuthorizations::WithNestedGroups * Gitlab::ProjectAuthorizations::WithoutNestedGroups Both classes get the fresh project authorizations (= as they should be in the "project_authorizations" table), including nested groups if PostgreSQL is used. The logic of these two classes is quite different apart from their public interface. This complicates development a bit, but unfortunately there is no way around this. This commit also introduces Gitlab::GroupHierarchy. This class can be used to get the ancestors and descendants of a base relation, or both by using a UNION. This in turn is used by methods such as: * Namespace#ancestors * Namespace#descendants * User#all_expanded_groups Again this class relies on CTEs and thus only works on PostgreSQL. The Namespace methods will return an empty relation when MySQL is used, while User#all_expanded_groups will return only the groups a user is a direct member of. Performance wise the impact is quite large. For example, on GitLab.com Namespace#descendants used to take around 580 ms to retrieve data for a particular user. Using CTEs we are able to reduce this down to roughly 1 millisecond, returning the exact same data. == On The Fly Refreshing Refreshing of authorizations on the fly (= when users.authorized_projects_populated was not set) is removed with this commit. This simplifies the code, and ensures any queries used for authorizations are not mutated because they are executed in a Rails scope (e.g. Project.visible_to_user). This commit includes a migration to schedule refreshing authorizations for all users, ensuring all of them have their authorizations in place. Said migration schedules users in batches of 5000, with 5 minutes between every batch to smear the load around a bit. == Spec Changes This commit also introduces some changes to various specs. For example, some specs for ProjectTeam assumed that creating a personal project would _not_ lead to the owner having access, which is incorrect. Because we also no longer refresh authorizations on the fly for new users some code had to be added to the "empty_project" factory. This chunk of code ensures that the owner's permissions are refreshed after creating the project, something that is normally done in Projects::CreateService.
* | Use wait_for_requests to wait all JS requestwait-for-ajax-handling-all-js-requestsOswaldo Ferreira2017-05-221-1/+0
| |
* | Enable RSpec profiling only if RSPEC_PROFILING_POSTGRES_URL is not empty31933-improve-rspec-profiling-enablingRémy Coutable2017-05-191-1/+1
|/ | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Resolve "rspec_profiling is enabled for MySQL"Rémy Coutable2017-04-281-2/+3
|
* Allow to enable `rspec_profiling` for a branch on the CI30907-allow-to-enable-rspec-profile-for-a-given-branchRémy Coutable2017-04-131-2/+8
| | | | | | | `rspec_profiling` will be enabled if the branch name includes `rspec-profile`. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Setup and run a Gitaly server for testing if GitalyClient is enabledgitaly-testingAlejandro Rodríguez2017-04-111-0/+4
|
* When on CI, enable RSpec profiling for `master` onlyRémy Coutable2017-03-241-1/+2
| | | | | | We don't actually need to monitor RSpec for all our branches. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Only include WaitForAjax for :js specsRémy Coutable2017-03-221-1/+1
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Introduce a new middleware for the test environment that can block requestsRémy Coutable2017-03-221-0/+1
| | | | | | | | | | | | The idea is that after each feature spec example, we block all incoming requests at the Rack level, go to the 'about:blank' page, and wait until the current requests reach 0. This should solve the problem where a request would end after database cleaner performed the database truncation. The problem was that a GET request can still lead to records creation (e.g. namespaces or routes). Signed-off-by: Rémy Coutable <remy@rymai.me>
* Retry only on feature specs that use JS, on CI29242-fix-api-specs-potential-weird-failures-on-retriesRémy Coutable2017-03-131-0/+7
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Implement `json_response` as a `let` variableRémy Coutable2017-03-131-0/+6
| | | | | | | | | | | | | | | This is not a good idea to memoize `json_response` using an instance variable because `rspec-retry` doesn't clear instance variables on retries, only `let` variables. This will avoid issues where retries would fail on a different line that the original failure, blurrying what's the real failure. Also, automatically add api: true to specs under /spec/requests/(ci/)?api/, and include JsonHelpers in controller, request and API specs. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Shave spec/features/issues/filtered_search/dropdown_label_spec.rb from 10 ↵27564-shave-dropdown-label-search-spec-durationRémy Coutable2017-02-031-0/+1
| | | | | | | | | | | | | | | minutes to 1.5 minutes - Don't use `sleep` (most of the time was wasted by that) - Expect some elements to be visible instead: capybara is smart enough to retry a few times if it cannot find an element - See https://github.com/teamcapybara/capybara#asynchronous-javascript-ajax-and-friends - Don't create unneccessary DB records - Group some examples together to shave some setup time (where it makes sense) Signed-off-by: Rémy Coutable <remy@rymai.me>
* Add the rspec_profiling gem and documentation to the GitLab development ↵23034-enable-rspec-profilingNick Thomas2017-01-271-0/+4
| | | | environment