Commit 0450e8ee authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '32727-test-foss' into 'master'

Also run simulated FOSS tests (system test in next iteration)

See merge request gitlab-org/gitlab!18000
parents d42a943c d58737fb
...@@ -123,7 +123,7 @@ compile-assets pull-cache: ...@@ -123,7 +123,7 @@ compile-assets pull-cache:
- .use-pg9 - .use-pg9
dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"] dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"]
karma: .karma-base:
extends: .only-code-frontend-job-base extends: .only-code-frontend-job-base
variables: variables:
# we override the max_old_space_size to prevent OOM errors # we override the max_old_space_size to prevent OOM errors
...@@ -134,6 +134,9 @@ karma: ...@@ -134,6 +134,9 @@ karma:
- scripts/gitaly-test-spawn - scripts/gitaly-test-spawn
- date - date
- bundle exec rake karma - bundle exec rake karma
karma:
extends: .karma-base
coverage: '/^Statements *: (\d+\.\d+%)/' coverage: '/^Statements *: (\d+\.\d+%)/'
artifacts: artifacts:
name: coverage-javascript name: coverage-javascript
...@@ -146,7 +149,12 @@ karma: ...@@ -146,7 +149,12 @@ karma:
reports: reports:
junit: junit_karma.xml junit: junit_karma.xml
jest: karma-foss:
extends:
- .karma-base
- .only-ee-as-if-foss
.jest-base:
extends: .only-code-frontend-job-base extends: .only-code-frontend-job-base
script: script:
- scripts/gitaly-test-spawn - scripts/gitaly-test-spawn
...@@ -154,6 +162,14 @@ jest: ...@@ -154,6 +162,14 @@ jest:
- bundle exec rake frontend:fixtures - bundle exec rake frontend:fixtures
- date - date
- yarn jest --ci --coverage - yarn jest --ci --coverage
cache:
key: jest
paths:
- tmp/jest/jest/
policy: pull-push
jest:
extends: .jest-base
artifacts: artifacts:
name: coverage-frontend name: coverage-frontend
expire_in: 31d expire_in: 31d
...@@ -164,11 +180,13 @@ jest: ...@@ -164,11 +180,13 @@ jest:
- tmp/tests/frontend/ - tmp/tests/frontend/
reports: reports:
junit: junit_jest.xml junit: junit_jest.xml
jest-foss:
extends:
- .jest-base
- .only-ee-as-if-foss
cache: cache:
key: jest policy: pull
paths:
- tmp/jest/jest/
policy: pull-push
.qa-job-base: .qa-job-base:
extends: extends:
......
...@@ -149,3 +149,8 @@ ...@@ -149,3 +149,8 @@
variables: variables:
- $CI_PROJECT_NAME == "gitlab" - $CI_PROJECT_NAME == "gitlab"
- $CI_PROJECT_NAME == "gitlab-ee" # Support former project name for forks/mirrors - $CI_PROJECT_NAME == "gitlab-ee" # Support former project name for forks/mirrors
.only-ee-as-if-foss:
extends: .only-ee
variables:
IS_GITLAB_EE: '0'
...@@ -74,6 +74,12 @@ setup-test-env: ...@@ -74,6 +74,12 @@ setup-test-env:
- .rspec-base - .rspec-base
- .use-pg9 - .use-pg9
.rspec-base-pg9-foss:
extends:
- .rspec-base
- .use-pg9
- .only-ee-as-if-foss
.rspec-base-pg10: .rspec-base-pg10:
extends: extends:
- .rspec-base - .rspec-base
...@@ -84,14 +90,27 @@ rspec unit pg9: ...@@ -84,14 +90,27 @@ rspec unit pg9:
extends: .rspec-base-pg9 extends: .rspec-base-pg9
parallel: 20 parallel: 20
rspec unit pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 20
rspec integration pg9: rspec integration pg9:
extends: .rspec-base-pg9 extends: .rspec-base-pg9
parallel: 6 parallel: 6
rspec integration pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 6
rspec system pg9: rspec system pg9:
extends: .rspec-base-pg9 extends: .rspec-base-pg9
parallel: 24 parallel: 24
# TODO: This requires FOSS assets
# rspec system pg9-foss:
# extends: .rspec-base-pg9-foss
# parallel: 24
rspec unit pg10: rspec unit pg10:
extends: .rspec-base-pg10 extends: .rspec-base-pg10
parallel: 20 parallel: 20
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'optparse' require 'optparse'
require_relative '../../lib/gitlab'
require_relative '../../lib/gitlab/utils'
require_relative '../../lib/gitlab/sidekiq_config' require_relative '../../lib/gitlab/sidekiq_config'
require_relative '../lib/gitlab/sidekiq_cluster' require_relative '../lib/gitlab/sidekiq_cluster'
require_relative '../lib/gitlab/sidekiq_cluster/cli' require_relative '../lib/gitlab/sidekiq_cluster/cli'
......
...@@ -15,7 +15,10 @@ if (process.env.CI) { ...@@ -15,7 +15,10 @@ if (process.env.CI) {
]); ]);
} }
let testMatch = ['<rootDir>/spec/frontend/**/*_spec.js', '<rootDir>/ee/spec/frontend/**/*_spec.js']; let testMatch = ['<rootDir>/spec/frontend/**/*_spec.js'];
if (IS_EE) {
testMatch.push('<rootDir>/ee/spec/frontend/**/*_spec.js');
}
// workaround for eslint-import-resolver-jest only resolving in test files // workaround for eslint-import-resolver-jest only resolving in test files
// see https://github.com/JoinColony/eslint-import-resolver-jest#note // see https://github.com/JoinColony/eslint-import-resolver-jest#note
......
...@@ -5,7 +5,11 @@ require 'set' ...@@ -5,7 +5,11 @@ require 'set'
module Gitlab module Gitlab
module SidekiqConfig module SidekiqConfig
QUEUE_CONFIG_PATHS = %w[app/workers/all_queues.yml ee/app/workers/all_queues.yml].freeze QUEUE_CONFIG_PATHS = begin
result = %w[app/workers/all_queues.yml]
result << 'ee/app/workers/all_queues.yml' if Gitlab.ee?
result
end.freeze
# This method is called by `ee/bin/sidekiq-cluster` in EE, which runs outside # This method is called by `ee/bin/sidekiq-cluster` in EE, which runs outside
# of bundler/Rails context, so we cannot use any gem or Rails methods. # of bundler/Rails context, so we cannot use any gem or Rails methods.
...@@ -48,9 +52,11 @@ module Gitlab ...@@ -48,9 +52,11 @@ module Gitlab
end end
def self.workers def self.workers
@workers ||= @workers ||= begin
find_workers(Rails.root.join('app', 'workers')) + result = find_workers(Rails.root.join('app', 'workers'))
find_workers(Rails.root.join('ee', 'app', 'workers')) result.concat(find_workers(Rails.root.join('ee', 'app', 'workers'))) if Gitlab.ee?
result
end
end end
def self.find_workers(root) def self.find_workers(root)
......
...@@ -2,7 +2,10 @@ unless Rails.env.production? ...@@ -2,7 +2,10 @@ unless Rails.env.production?
namespace :frontend do namespace :frontend do
desc 'GitLab | Frontend | Generate fixtures for JavaScript tests' desc 'GitLab | Frontend | Generate fixtures for JavaScript tests'
RSpec::Core::RakeTask.new(:fixtures, [:pattern]) do |t, args| RSpec::Core::RakeTask.new(:fixtures, [:pattern]) do |t, args|
args.with_defaults(pattern: '{spec,ee/spec}/frontend/fixtures/*.rb') directories = %w[spec]
directories << 'ee/spec' if Gitlab.ee?
directory_glob = "{#{directories.join(',')}}"
args.with_defaults(pattern: "#{directory_glob}/frontend/fixtures/*.rb")
ENV['NO_KNAPSACK'] = 'true' ENV['NO_KNAPSACK'] = 'true'
t.pattern = args[:pattern] t.pattern = args[:pattern]
t.rspec_opts = '--format documentation' t.rspec_opts = '--format documentation'
......
...@@ -256,7 +256,7 @@ describe Projects::EnvironmentsController do ...@@ -256,7 +256,7 @@ describe Projects::EnvironmentsController do
it 'loads the terminals for the environment' do it 'loads the terminals for the environment' do
# In EE we have to stub EE::Environment since it overwrites the # In EE we have to stub EE::Environment since it overwrites the
# "terminals" method. # "terminals" method.
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment) expect_any_instance_of(Gitlab.ee? ? EE::Environment : Environment)
.to receive(:terminals) .to receive(:terminals)
get :terminal, params: environment_params get :terminal, params: environment_params
...@@ -282,7 +282,7 @@ describe Projects::EnvironmentsController do ...@@ -282,7 +282,7 @@ describe Projects::EnvironmentsController do
it 'returns the first terminal for the environment' do it 'returns the first terminal for the environment' do
# In EE we have to stub EE::Environment since it overwrites the # In EE we have to stub EE::Environment since it overwrites the
# "terminals" method. # "terminals" method.
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment) expect_any_instance_of(Gitlab.ee? ? EE::Environment : Environment)
.to receive(:terminals) .to receive(:terminals)
.and_return([:fake_terminal]) .and_return([:fake_terminal])
......
...@@ -150,6 +150,7 @@ describe Gitlab do ...@@ -150,6 +150,7 @@ describe Gitlab do
describe '.ee?' do describe '.ee?' do
before do before do
stub_env('IS_GITLAB_EE', nil) # Make sure the ENV is clean
described_class.instance_variable_set(:@is_ee, nil) described_class.instance_variable_set(:@is_ee, nil)
end end
......
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