Commit d58737fb authored by Lin Jen-Shin's avatar Lin Jen-Shin

Also run FOSS version of rspec, jest, karma

However we don't run FOSS system tests for now,
because it requires FOSS assets (perhaps?)

Let's run other tests first.
parent 0a79d1b2
......@@ -123,7 +123,7 @@ compile-assets pull-cache:
- .use-pg9
dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"]
karma:
.karma-base:
extends: .only-code-frontend-job-base
variables:
# we override the max_old_space_size to prevent OOM errors
......@@ -134,6 +134,9 @@ karma:
- scripts/gitaly-test-spawn
- date
- bundle exec rake karma
karma:
extends: .karma-base
coverage: '/^Statements *: (\d+\.\d+%)/'
artifacts:
name: coverage-javascript
......@@ -146,7 +149,12 @@ karma:
reports:
junit: junit_karma.xml
jest:
karma-foss:
extends:
- .karma-base
- .only-ee-as-if-foss
.jest-base:
extends: .only-code-frontend-job-base
script:
- scripts/gitaly-test-spawn
......@@ -154,6 +162,14 @@ jest:
- bundle exec rake frontend:fixtures
- date
- yarn jest --ci --coverage
cache:
key: jest
paths:
- tmp/jest/jest/
policy: pull-push
jest:
extends: .jest-base
artifacts:
name: coverage-frontend
expire_in: 31d
......@@ -164,11 +180,13 @@ jest:
- tmp/tests/frontend/
reports:
junit: junit_jest.xml
jest-foss:
extends:
- .jest-base
- .only-ee-as-if-foss
cache:
key: jest
paths:
- tmp/jest/jest/
policy: pull-push
policy: pull
.qa-job-base:
extends:
......
......@@ -149,3 +149,8 @@
variables:
- $CI_PROJECT_NAME == "gitlab"
- $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:
- .rspec-base
- .use-pg9
.rspec-base-pg9-foss:
extends:
- .rspec-base
- .use-pg9
- .only-ee-as-if-foss
.rspec-base-pg10:
extends:
- .rspec-base
......@@ -84,14 +90,27 @@ rspec unit pg9:
extends: .rspec-base-pg9
parallel: 20
rspec unit pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 20
rspec integration pg9:
extends: .rspec-base-pg9
parallel: 6
rspec integration pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 6
rspec system pg9:
extends: .rspec-base-pg9
parallel: 24
# TODO: This requires FOSS assets
# rspec system pg9-foss:
# extends: .rspec-base-pg9-foss
# parallel: 24
rspec unit pg10:
extends: .rspec-base-pg10
parallel: 20
......
......@@ -2,6 +2,8 @@
# frozen_string_literal: true
require 'optparse'
require_relative '../../lib/gitlab'
require_relative '../../lib/gitlab/utils'
require_relative '../../lib/gitlab/sidekiq_config'
require_relative '../lib/gitlab/sidekiq_cluster'
require_relative '../lib/gitlab/sidekiq_cluster/cli'
......
......@@ -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
// see https://github.com/JoinColony/eslint-import-resolver-jest#note
......
......@@ -5,7 +5,11 @@ require 'set'
module Gitlab
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
# of bundler/Rails context, so we cannot use any gem or Rails methods.
......@@ -48,9 +52,11 @@ module Gitlab
end
def self.workers
@workers ||=
find_workers(Rails.root.join('app', 'workers')) +
find_workers(Rails.root.join('ee', 'app', 'workers'))
@workers ||= begin
result = find_workers(Rails.root.join('app', 'workers'))
result.concat(find_workers(Rails.root.join('ee', 'app', 'workers'))) if Gitlab.ee?
result
end
end
def self.find_workers(root)
......
......@@ -2,7 +2,10 @@ unless Rails.env.production?
namespace :frontend do
desc 'GitLab | Frontend | Generate fixtures for JavaScript tests'
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'
t.pattern = args[:pattern]
t.rspec_opts = '--format documentation'
......
......@@ -256,7 +256,7 @@ describe Projects::EnvironmentsController do
it 'loads the terminals for the environment' do
# In EE we have to stub EE::Environment since it overwrites the
# "terminals" method.
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
expect_any_instance_of(Gitlab.ee? ? EE::Environment : Environment)
.to receive(:terminals)
get :terminal, params: environment_params
......@@ -282,7 +282,7 @@ describe Projects::EnvironmentsController do
it 'returns the first terminal for the environment' do
# In EE we have to stub EE::Environment since it overwrites the
# "terminals" method.
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
expect_any_instance_of(Gitlab.ee? ? EE::Environment : Environment)
.to receive(:terminals)
.and_return([:fake_terminal])
......
......@@ -150,6 +150,7 @@ describe Gitlab do
describe '.ee?' do
before do
stub_env('IS_GITLAB_EE', nil) # Make sure the ENV is clean
described_class.instance_variable_set(:@is_ee, nil)
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