-
Notifications
You must be signed in to change notification settings - Fork 10
/
knapsack_pro_all.rb
executable file
·109 lines (97 loc) · 5.93 KB
/
knapsack_pro_all.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
require 'securerandom'
COMMANDS = {
'./bin/knapsack_pro_a_few_commands' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
# RSpec
'./bin/knapsack_pro_rspec' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_user_seat' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_cache_read_attempt' => ['0 2', '1 2'],
'./bin/knapsack_pro_rspec_junit' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_only_partial_nodes' => ['0 3 BUILD_ID', '1 3 BUILD_ID'],
'./bin/knapsack_pro_rspec_encrypted' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_disabled' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_fallback_mode' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_test_dir' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_test_file_exclude_pattern' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_rspec_split_by_test_examples' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_test_file_list' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_test_file_list_source_file' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_user_seat' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_record_first_run' => ['0 2', '1 2'],
'./bin/knapsack_pro_queue_rspec_record_first_run_junit' => ['0 2 COMMIT_HASH BUILD_ID', '1 2 COMMIT_HASH BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_split_by_test_examples' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_split_by_test_examples_spec_opts' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_split_by_test_examples_test_example_detector_prefix' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_split_by_test_examples_unique_build' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_tags' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_default_formatter' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_profile_formatter' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_junit' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_junit_with_rspec_custom_options' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_log_dir' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_json' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_test_dir' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_test_file_exclude_pattern' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_frequently_changing_test_files' => [''],
'./bin/knapsack_pro_queue_rspec_initialized_once' => ['0 2', '1 2'],
'./bin/knapsack_pro_queue_rspec_only_failures' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_order_defined' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_order_rand' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_order_rand_with_custom_seed' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_order_random' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_order_random_defined_in_config' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_fixed_queue_rspec_queue_consumed_at_least_once_with_ci_build_id' => [''],
'./bin/knapsack_pro_fixed_queue_split_rspec' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_fixed_queue_split_rspec_custom_branch_commit' => ['0 2 branch-name BUILD_ID', '1 2 branch-name BUILD_ID'],
'./bin/knapsack_pro_queue_rspec_encrypted' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_fixed_queue_split_rspec_encrypted' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/parallel_tests_knapsack_pro_queue_rspec' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/parallel_tests_knapsack_pro_single_machine_run BUILD_ID' => [''],
'./bin/bin_knapsack_pro_rspec' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/bin_knapsack_pro_queue_rspec' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_turnip' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
# inside of this bash scripts we run 2 parallel nodes
'./bin/knapsack_pro_split_by_test_cases_rspec' => [''],
'./bin/knapsack_pro_split_by_test_cases_queue_rspec' => [''],
# Cucumber
'./bin/knapsack_pro_cucumber' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_cucumber_junit' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_cucumber' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_cucumber_junit' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_cucumber_prefix' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
# Minitest
'./bin/knapsack_pro_minitest' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_queue_minitest' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
'./bin/knapsack_pro_fixed_queue_split_minitest_custom_branch_commit' => ['0 2 branch-name BUILD_ID', '1 2 branch-name BUILD_ID'],
'./bin/bin_knapsack_pro_queue_minitest' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
# Test::Unit
'./bin/knapsack_pro_test_unit' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
# Spinach
'./bin/knapsack_pro_spinach' => ['0 2 BUILD_ID', '1 2 BUILD_ID'],
}
failed_commands = []
commands_count = COMMANDS.keys.size
COMMANDS.each_with_index do |(command, args), command_index|
uuid = SecureRandom.uuid
commit_hash = SecureRandom.hex
args
.map { _1.sub('BUILD_ID', uuid) }
.map { _1.sub('COMMIT_HASH', commit_hash) }
.each do |arg|
cmd = [command, arg].join(' ')
puts "="*50
puts "EXECUTING (#{command_index+1} of #{commands_count}): #{cmd}"
puts
system(cmd)
(failed_commands << command) if $?.exitstatus != 0
end
end
puts
puts '=' * 20
puts
if failed_commands.empty?
puts 'All tests pass with success!'
else
puts 'Something failed! You can retry those commands:'
puts failed_commands
end