Commit 3fd0b364 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'knapsack' into 'master'

Use Knapsack to evenly distribute specs

Try to distribute all tests evenly accross all nodes to reduce the testing time of GitLab CE.

This uses high amount of auto-scaled machines.


See merge request !4240
parents 981829f3 12dd7bd7
This diff is collapsed.
......@@ -316,6 +316,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.11.0)
rake
timecop (>= 0.1.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
......@@ -735,6 +738,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)
......@@ -882,6 +886,7 @@ DEPENDENCIES
jquery-ui-rails (~> 5.0.0)
jwt
kaminari (~> 0.17.0)
knapsack
letter_opener_web (~> 1.3.0)
license_finder
licensee (~> 8.0.0)
......
......@@ -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,11 +11,14 @@ ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec/expectations'
require 'sidekiq/testing/inline'
require 'knapsack'
require_relative 'capybara'
require_relative 'db_cleaner'
require_relative 'rerun'
Knapsack::Adapters::SpinachAdapter.bind
%w(select2_helper test_env repo_helpers).each do |f|
require Rails.root.join('spec', 'support', f)
end
......
#!/usr/bin/env ruby
require 'json'
require 'yaml'
main_report_file = ARGV.shift
unless main_report_file
puts 'usage: merge_reports <main-report> [extra reports...]'
exit 1
end
puts "Loading #{main_report_file}..."
main_report = JSON.parse(File.read(main_report_file))
new_report = main_report.dup
ARGV.each do |report_file|
report = JSON.parse(File.read(report_file))
# Remove existing values
updates = report.delete_if do |key, value|
main_report[key] && main_report[key] == value
end
new_report.merge!(updates)
puts "Merged #{report_file} adding #{updates.size} results."
end
File.write(main_report_file, JSON.pretty_generate(new_report))
puts "Saved #{main_report_file}."
#!/bin/bash
retry() {
for i in $(seq 1 3); do
if eval "$@"; then
return 0
fi
for i in 2 1; do
sleep 3s
echo "Retrying $i..."
if eval "$@"; then
return 0
fi
sleep 3s
echo "Retrying..."
done
return 1
}
......
......@@ -15,6 +15,9 @@ require 'rspec/rails'
require 'shoulda/matchers'
require 'sidekiq/testing/inline'
require 'rspec/retry'
require 'knapsack'
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