Commit 0a1fccb2 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Try to use knapsack

parent ca3c5c29
......@@ -25,58 +25,55 @@ before_script:
- retry bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
- RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate
stages:
- test
- notifications
spec:feature:
stage: test
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
spec:api:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
spec:models:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
spec:lib:
.rspec_tests: &rspec_tests
stage: test
variables:
RAILS_ENV: "test"
SIMPLECOV: "true"
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
- JOB_NAME=( $CI_BUILD_NAME )
- export CI_NODE_INDEX=${JOB_NAME[1]}
- export CI_NODE_TOTAL=${JOB_NAME[2]}
- bundle exec rake assets:precompile 2>/dev/null
- bundle exec rake knapsack:rspec
spec:services:
.spinach_tests: &spinach_tests
stage: test
variables:
RAILS_ENV: "test"
SIMPLECOV: "true"
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
- JOB_NAME=( $CI_BUILD_NAME )
- export CI_NODE_INDEX=${JOB_NAME[1]}
- export CI_NODE_TOTAL=${JOB_NAME[2]}
- bundle exec rake assets:precompile 2>/dev/null
- bundle exec rake knapsack:cucumber
spec:other:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
spinach:project:half:
stage: test
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
spinach:project:rest:
stage: test
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
stages:
- test
- notifications
spinach:other:
stage: test
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
spec 0 10: *rspec_tests
spec 1 10: *rspec_tests
spec 2 10: *rspec_tests
spec 3 10: *rspec_tests
spec 4 10: *rspec_tests
spec 5 10: *rspec_tests
spec 6 10: *rspec_tests
spec 7 10: *rspec_tests
spec 8 10: *rspec_tests
spec 9 10: *rspec_tests
spinach 0 10: *spinach_tests
spinach 1 10: *spinach_tests
spinach 2 10: *spinach_tests
spinach 3 10: *spinach_tests
spinach 4 10: *spinach_tests
spinach 5 10: *spinach_tests
spinach 6 10: *spinach_tests
spinach 7 10: *spinach_tests
spinach 8 10: *spinach_tests
spinach 9 10: *spinach_tests
teaspoon:
stage: test
......
......@@ -313,6 +313,7 @@ group :test do
gem 'webmock', '~> 1.21.0'
gem 'test_after_commit', '~> 0.4.2'
gem 'sham_rack'
gem 'knapsack'
end
group :production do
......
......@@ -358,6 +358,9 @@ GEM
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.10.0)
knapsack (1.9.0)
rake
timecop (>= 0.1.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
......@@ -728,6 +731,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.2)
timecop (0.8.1)
timfel-krb5-auth (0.8.3)
tinder (1.10.1)
eventmachine (~> 1.0)
......@@ -874,6 +878,7 @@ DEPENDENCIES
jquery-ui-rails (~> 5.0.0)
jwt
kaminari (~> 0.17.0)
knapsack
letter_opener_web (~> 1.3.0)
licensee (~> 8.0.0)
loofah (~> 2.0.3)
......
......@@ -3,8 +3,11 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'knapsack'
relative_url_conf = File.expand_path('../config/initializers/relative_url', __FILE__)
require relative_url_conf if File.exist?("#{relative_url_conf}.rb")
Gitlab::Application.load_tasks
Knapsack.load_tasks
......@@ -11,6 +11,7 @@ ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec/expectations'
require 'sidekiq/testing/inline'
require 'knapsack'
require_relative 'capybara'
require_relative 'db_cleaner'
......@@ -20,6 +21,8 @@ require_relative 'rerun'
require Rails.root.join('spec', 'support', f)
end
Knapsack::Adapters::CucumberAdapter.bind
Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file }
WebMock.allow_net_connect!
......
begin
class Knapsack::Report
alias_method :save_without_leading_existing_report, :save
def load_existing_report
Knapsack::Presenter.existing_report = open
rescue
false
end
def save
load_existing_report
save_without_leading_existing_report
end
end
class << Knapsack::Presenter
attr_accessor :existing_report
def initialize
@existing_report = []
end
def report_hash
return current_report_hash unless existing_report
existing_report.merge(current_report_hash).sort.to_h
end
def current_report_hash
Knapsack.tracker.test_files_with_time
end
def report_yml
report_hash.to_yaml
end
def report_json
JSON.pretty_generate(report_hash)
end
end
end
......@@ -15,6 +15,10 @@ require 'rspec/rails'
require 'shoulda/matchers'
require 'sidekiq/testing/inline'
require 'rspec/retry'
require 'knapsack'
require_relative 'knapsack_merger'
Knapsack::Adapters::RSpecAdapter.bind
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
......
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