Commit e5a4ab49 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rc/move-all-ee-specs-to-ee-specs' into 'master'

Move all `spec/ee/spec/*` files to `ee/spec/`

See merge request gitlab-org/gitlab-ee!4231
parents 4d1de3bd 4d5ab72d
...@@ -19,3 +19,4 @@ app/models/project_services/kubernetes_service.rb ...@@ -19,3 +19,4 @@ app/models/project_services/kubernetes_service.rb
ee/db/**/* ee/db/**/*
ee/app/serializers/ee/merge_request_widget_entity.rb ee/app/serializers/ee/merge_request_widget_entity.rb
ee/lib/ee/gitlab/ldap/sync/admin_users.rb ee/lib/ee/gitlab/ldap/sync/admin_users.rb
ee/spec/**/*
...@@ -36,6 +36,7 @@ variables: ...@@ -36,6 +36,7 @@ variables:
# This hack is needed to make ES not that memory hungry # This hack is needed to make ES not that memory hungry
ES_JAVA_OPTS: "-Xms256m -Xmx256m" ES_JAVA_OPTS: "-Xms256m -Xmx256m"
ELASTIC_URL: "http://elastic:changeme@docker.elastic.co-elasticsearch-elasticsearch:9200" ELASTIC_URL: "http://elastic:changeme@docker.elastic.co-elasticsearch-elasticsearch:9200"
EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/${CI_PROJECT_NAME}/rspec_report-master-ee.json
before_script: before_script:
- bundle --version - bundle --version
...@@ -134,6 +135,30 @@ stages: ...@@ -134,6 +135,30 @@ stages:
<<: *rspec-metadata <<: *rspec-metadata
<<: *use-pg <<: *use-pg
.rspec-metadata-mysql: &rspec-metadata-mysql
<<: *rspec-metadata
<<: *use-mysql
.rspec-metadata-ee: &rspec-metadata-ee
<<: *rspec-metadata
stage: test
script:
- export KNAPSACK_TEST_FILE_PATTERN="ee/spec/**{,/*/**}/*_spec.rb" KNAPSACK_GENERATE_REPORT=true CACHE_CLASSES=true
- JOB_NAME=( $CI_JOB_NAME )
- export CI_NODE_INDEX=${JOB_NAME[-2]} CI_NODE_TOTAL=${JOB_NAME[-1]}
- export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${JOB_NAME[0]}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report-ee.json
- cp ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH} ${KNAPSACK_REPORT_PATH}
- scripts/gitaly-test-spawn
- knapsack rspec -Ispec --color --format documentation
.rspec-ee-pg: &rspec-ee-pg
<<: *rspec-metadata-ee
<<: *use-pg
.rspec-ee-mysql: &rspec-ee-mysql
<<: *rspec-metadata-ee
<<: *use-mysql
.rspec-geo-pg-9-6: &rspec-metadata-pg-geo .rspec-geo-pg-9-6: &rspec-metadata-pg-geo
<<: *rspec-metadata <<: *rspec-metadata
<<: *use-pg-9-6-no-elasticsearch <<: *use-pg-9-6-no-elasticsearch
...@@ -143,11 +168,7 @@ stages: ...@@ -143,11 +168,7 @@ stages:
- export CACHE_CLASSES=true - export CACHE_CLASSES=true
- source scripts/prepare_postgres_fdw.sh - source scripts/prepare_postgres_fdw.sh
- scripts/gitaly-test-spawn - scripts/gitaly-test-spawn
- bundle exec rspec --color --format documentation --tag geo spec/ - bundle exec rspec --color --format documentation --tag geo ee/spec/
.rspec-metadata-mysql: &rspec-metadata-mysql
<<: *rspec-metadata
<<: *use-mysql
.spinach-metadata: &spinach-metadata .spinach-metadata: &spinach-metadata
<<: *dedicated-runner <<: *dedicated-runner
...@@ -265,6 +286,8 @@ retrieve-tests-metadata: ...@@ -265,6 +286,8 @@ retrieve-tests-metadata:
- mkdir -p rspec_flaky/ - mkdir -p rspec_flaky/
- wget -O $FLAKY_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$FLAKY_RSPEC_SUITE_REPORT_PATH || rm $FLAKY_RSPEC_SUITE_REPORT_PATH - wget -O $FLAKY_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$FLAKY_RSPEC_SUITE_REPORT_PATH || rm $FLAKY_RSPEC_SUITE_REPORT_PATH
- '[[ -f $FLAKY_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_SUITE_REPORT_PATH}' - '[[ -f $FLAKY_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_SUITE_REPORT_PATH}'
- wget -O $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH
- '[[ -f $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH}'
update-tests-metadata: update-tests-metadata:
<<: *tests-metadata-state <<: *tests-metadata-state
...@@ -280,8 +303,10 @@ update-tests-metadata: ...@@ -280,8 +303,10 @@ update-tests-metadata:
- retry gem install fog-aws mime-types - retry gem install fog-aws mime-types
- scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_node_*.json - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_node_*.json
- scripts/merge-reports ${KNAPSACK_SPINACH_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/spinach-pg_node_*.json - scripts/merge-reports ${KNAPSACK_SPINACH_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/spinach-pg_node_*.json
- scripts/merge-reports ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_node_*-ee.json
- scripts/merge-reports ${FLAKY_RSPEC_SUITE_REPORT_PATH} rspec_flaky/all_*_*.json - scripts/merge-reports ${FLAKY_RSPEC_SUITE_REPORT_PATH} rspec_flaky/all_*_*.json
- '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH $KNAPSACK_SPINACH_SUITE_REPORT_PATH' - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH $KNAPSACK_SPINACH_SUITE_REPORT_PATH'
- '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH'
- '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $FLAKY_RSPEC_SUITE_REPORT_PATH' - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $FLAKY_RSPEC_SUITE_REPORT_PATH'
- rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json
- rm -f rspec_flaky/all_*.json rspec_flaky/new_*.json - rm -f rspec_flaky/all_*.json rspec_flaky/new_*.json
...@@ -346,7 +371,13 @@ setup-test-env: ...@@ -346,7 +371,13 @@ setup-test-env:
- tmp/tests - tmp/tests
- config/secrets.yml - config/secrets.yml
# EE jobs
rspec-pg-ee 0 2: *rspec-ee-pg
rspec-pg-ee 1 2: *rspec-ee-pg
rspec-mysql-ee 0 2: *rspec-ee-mysql
rspec-mysql-ee 1 2: *rspec-ee-mysql
rspec-pg geo: *rspec-metadata-pg-geo rspec-pg geo: *rspec-metadata-pg-geo
## EE jobs
rspec-pg 0 27: *rspec-metadata-pg rspec-pg 0 27: *rspec-metadata-pg
rspec-pg 1 27: *rspec-metadata-pg rspec-pg 1 27: *rspec-metadata-pg
......
...@@ -10,10 +10,9 @@ AllCops: ...@@ -10,10 +10,9 @@ AllCops:
Exclude: Exclude:
- 'vendor/**/*' - 'vendor/**/*'
- 'node_modules/**/*' - 'node_modules/**/*'
- 'db/*' - 'db/**/*'
- 'db/fixtures/**/*' - 'db/fixtures/**/*'
- 'db/geo/*' - 'ee/db/**/*'
- 'ee/db/geo/*'
- 'tmp/**/*' - 'tmp/**/*'
- 'bin/**/*' - 'bin/**/*'
- 'generator_templates/**/*' - 'generator_templates/**/*'
...@@ -27,7 +26,6 @@ Style/MutableConstant: ...@@ -27,7 +26,6 @@ Style/MutableConstant:
Exclude: Exclude:
- 'db/migrate/**/*' - 'db/migrate/**/*'
- 'db/post_migrate/**/*' - 'db/post_migrate/**/*'
- 'db/geo/migrate/**/*'
- 'ee/db/migrate/**/*' - 'ee/db/migrate/**/*'
- 'ee/db/post_migrate/**/*' - 'ee/db/post_migrate/**/*'
- 'ee/db/geo/migrate/**/*' - 'ee/db/geo/migrate/**/*'
...@@ -46,3 +44,16 @@ Gitlab/ModuleWithInstanceVariables: ...@@ -46,3 +44,16 @@ Gitlab/ModuleWithInstanceVariables:
# We ignore spec helpers because it usually doesn't matter # We ignore spec helpers because it usually doesn't matter
- spec/support/**/*.rb - spec/support/**/*.rb
- features/steps/**/*.rb - features/steps/**/*.rb
GitlabSecurity/PublicSend:
Enabled: true
Exclude:
- 'config/**/*'
- 'db/**/*'
- 'features/**/*'
- 'lib/**/*.rake'
- 'qa/**/*'
- 'spec/**/*'
- 'ee/db/**/*'
- 'ee/lib/**/*.rake'
- 'ee/spec/**/*'
...@@ -28,9 +28,8 @@ we still need to merge changes from GitLab CE to EE. To help us get there, ...@@ -28,9 +28,8 @@ we still need to merge changes from GitLab CE to EE. To help us get there,
we should make sure that we no longer edit CE files in place in order to we should make sure that we no longer edit CE files in place in order to
implement EE features. implement EE features.
Instead, all EE codes should be put inside the `ee/` top-level directory, and Instead, all EE code should be put inside the `ee/` top-level directory. The
tests should be put inside `spec/ee/`. We don't use `ee/spec` for now due to rest of the code should be as close to the CE files as possible.
technical limitation. The rest of codes should be as close as to the CE files.
[single code base]: https://gitlab.com/gitlab-org/gitlab-ee/issues/2952#note_41016454 [single code base]: https://gitlab.com/gitlab-org/gitlab-ee/issues/2952#note_41016454
...@@ -318,7 +317,7 @@ When you're testing EE-only features, avoid adding examples to the ...@@ -318,7 +317,7 @@ When you're testing EE-only features, avoid adding examples to the
existing CE specs. Also do no change existing CE examples, since they existing CE specs. Also do no change existing CE examples, since they
should remain working as-is when EE is running without a license. should remain working as-is when EE is running without a license.
Instead place EE specs in the `spec/ee/spec` folder. Instead place EE specs in the `ee/spec` folder.
## JavaScript code in `assets/javascripts/` ## JavaScript code in `assets/javascripts/`
......
...@@ -136,7 +136,7 @@ learn more. ...@@ -136,7 +136,7 @@ learn more.
## EE-specific tests ## EE-specific tests
EE-specific tests follows the same organization, but under the `spec/ee` folder. EE-specific tests follows the same organization, but under the `ee/spec` folder.
## How to test at the correct level? ## How to test at the correct level?
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"last_deployment": { "last_deployment": {
"oneOf": [ "oneOf": [
{ {
"$ref": "deployment.json" "$ref": "../../../../../spec/fixtures/api/schemas/deployment.json"
}, },
{ {
"type": ["null"] "type": ["null"]
......
{ {
"type": "object", "type": "object",
"allOf": [ "allOf": [
{ "$ref": "../../../../../../fixtures/api/schemas/public_api/v4/board.json" }, { "$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/board.json" },
{ {
"required" : [ "required" : [
"name", "name",
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
}, },
"issue": { "issue": {
"allOf": [ "allOf": [
{ "$ref": "../../../../../../fixtures/api/schemas/public_api/v4/issue.json" }, { "$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/issue.json" },
{ {
"properties": { "properties": {
"weight": { "type": ["integer", "null"] } "weight": { "type": ["integer", "null"] }
......
{ {
"allOf": [ "allOf": [
{ "$ref": "../../../../../../fixtures/api/schemas/public_api/v4/issues.json" }, { "$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/issues.json" },
{ {
"properties": { "properties": {
"weight": { "type": ["integer", "null"] } "weight": { "type": ["integer", "null"] }
......
...@@ -18,7 +18,7 @@ end ...@@ -18,7 +18,7 @@ end
# EE-only # EE-only
%w(test_license).each do |f| %w(test_license).each do |f|
require Rails.root.join('spec', 'support', f) require Rails.root.join('ee', 'spec', 'support', f)
end end
Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file } Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file }
......
...@@ -60,7 +60,7 @@ describe Projects::EnvironmentsController do ...@@ -60,7 +60,7 @@ describe Projects::EnvironmentsController do
end end
it 'responds with matching schema' do it 'responds with matching schema' do
expect(response).to match_response_schema('environments') expect(response).to match_response_schema('environments', dir: 'ee')
end end
it 'responds with a payload describing available environments' do it 'responds with a payload describing available environments' do
......
...@@ -31,7 +31,7 @@ end ...@@ -31,7 +31,7 @@ end
require 'rainbow/ext/string' require 'rainbow/ext/string'
# EE specific support # EE specific support
Dir[Rails.root.join("spec/ee/support/**/*.rb")].each { |f| require f } Dir[Rails.root.join("ee/spec/support/**/*.rb")].each { |f| require f }
# Requires supporting ruby files with custom matchers and macros, etc, # Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories. # in spec/support/ and its subdirectories.
......
module SchemaPath module SchemaPath
def self.expand(schema, dir = '') def self.expand(schema, dir = '')
Rails.root.join('spec', dir, "fixtures/api/schemas/#{schema}.json").to_s Rails.root.join(dir, 'spec', "fixtures/api/schemas/#{schema}.json").to_s
end end
end end
......
...@@ -16,7 +16,7 @@ module FixtureHelpers ...@@ -16,7 +16,7 @@ module FixtureHelpers
end end
def expand_fixture_ee_path(filename) def expand_fixture_ee_path(filename)
File.expand_path(Rails.root.join('spec/ee/fixtures/', filename)) File.expand_path(Rails.root.join('ee/spec/fixtures/', filename))
end end
end end
......
require_dependency Rails.root.join('spec', 'ee', 'support', 'stub_configuration') require_dependency Rails.root.join('ee', 'spec', 'support', 'stub_configuration')
module StubConfiguration module StubConfiguration
prepend EE::StubConfiguration prepend EE::StubConfiguration
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment