knapsack_pro 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/knapsack_pro/adapters/minitest_adapter.rb +8 -13
- data/lib/knapsack_pro/client/connection.rb +1 -1
- data/lib/knapsack_pro/config/env.rb +1 -24
- data/lib/knapsack_pro/version.rb +1 -1
- metadata +2 -196
- data/.circleci/config.yml +0 -468
- data/.github/assets/install-button.png +0 -0
- data/.github/assets/knapsack-diamonds.png +0 -0
- data/.github/dependabot.yml +0 -11
- data/.github/pull_request_template.md +0 -11
- data/.gitignore +0 -39
- data/.rspec +0 -5
- data/CHANGELOG.md +0 -1995
- data/Gemfile +0 -13
- data/LICENSE +0 -22
- data/README.md +0 -90
- data/Rakefile +0 -2
- data/knapsack_pro.gemspec +0 -43
- data/spec/fixtures/test_file_list_source_file.txt +0 -6
- data/spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/invalid_test_suite_token.yml +0 -59
- data/spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/success.yml +0 -61
- data/spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/invalid_test_suite_token.yml +0 -50
- data/spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/success.yml +0 -50
- data/spec/integration/api/build_distributions_subset_spec.rb +0 -77
- data/spec/integration/api/build_subsets_create_spec.rb +0 -77
- data/spec/integration/runners/fallback_spec.rb +0 -131
- data/spec/integration/runners/queue/cucumber_runner_fallback_spec.rb +0 -129
- data/spec/integration/runners/queue/minitest_runner_fallback_spec.rb +0 -129
- data/spec/integration/runners/queue/rspec_runner.rb +0 -80
- data/spec/integration/runners/queue/rspec_runner_fallback_spec.rb +0 -137
- data/spec/integration/runners/queue/rspec_runner_spec.rb +0 -2672
- data/spec/knapsack_pro/adapters/base_adapter_spec.rb +0 -221
- data/spec/knapsack_pro/adapters/cucumber_adapter_spec.rb +0 -216
- data/spec/knapsack_pro/adapters/minitest_adapter_spec.rb +0 -189
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +0 -427
- data/spec/knapsack_pro/adapters/spinach_adapter_spec.rb +0 -61
- data/spec/knapsack_pro/adapters/test_unit_adapter_spec.rb +0 -86
- data/spec/knapsack_pro/base_allocator_builder_spec.rb +0 -102
- data/spec/knapsack_pro/build_distribution_fetcher_spec.rb +0 -89
- data/spec/knapsack_pro/client/api/action_spec.rb +0 -17
- data/spec/knapsack_pro/client/api/v1/base_spec.rb +0 -2
- data/spec/knapsack_pro/client/api/v1/build_distributions_spec.rb +0 -95
- data/spec/knapsack_pro/client/api/v1/build_subsets_spec.rb +0 -35
- data/spec/knapsack_pro/client/api/v1/queues_spec.rb +0 -83
- data/spec/knapsack_pro/client/connection_spec.rb +0 -581
- data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +0 -87
- data/spec/knapsack_pro/config/ci/base_spec.rb +0 -10
- data/spec/knapsack_pro/config/ci/buildkite_spec.rb +0 -135
- data/spec/knapsack_pro/config/ci/circle_spec.rb +0 -122
- data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +0 -87
- data/spec/knapsack_pro/config/ci/codefresh_spec.rb +0 -81
- data/spec/knapsack_pro/config/ci/codeship_spec.rb +0 -80
- data/spec/knapsack_pro/config/ci/github_actions_spec.rb +0 -140
- data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +0 -137
- data/spec/knapsack_pro/config/ci/heroku_spec.rb +0 -87
- data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +0 -133
- data/spec/knapsack_pro/config/ci/semaphore_spec.rb +0 -87
- data/spec/knapsack_pro/config/ci/travis_spec.rb +0 -73
- data/spec/knapsack_pro/config/env_generator_spec.rb +0 -52
- data/spec/knapsack_pro/config/env_spec.rb +0 -1291
- data/spec/knapsack_pro/config/temp_files_spec.rb +0 -25
- data/spec/knapsack_pro/crypto/branch_encryptor_spec.rb +0 -53
- data/spec/knapsack_pro/crypto/decryptor_spec.rb +0 -83
- data/spec/knapsack_pro/crypto/digestor_spec.rb +0 -13
- data/spec/knapsack_pro/crypto/encryptor_spec.rb +0 -58
- data/spec/knapsack_pro/formatters/time_tracker_fetcher_spec.rb +0 -27
- data/spec/knapsack_pro/formatters/time_tracker_spec.rb +0 -448
- data/spec/knapsack_pro/hooks/queue_spec.rb +0 -199
- data/spec/knapsack_pro/presenter_spec.rb +0 -57
- data/spec/knapsack_pro/pure/queue/rspec_pure_spec.rb +0 -248
- data/spec/knapsack_pro/queue_spec.rb +0 -35
- data/spec/knapsack_pro/report_spec.rb +0 -232
- data/spec/knapsack_pro/repository_adapter_initiator_spec.rb +0 -21
- data/spec/knapsack_pro/repository_adapters/base_adapter_spec.rb +0 -13
- data/spec/knapsack_pro/repository_adapters/env_adapter_spec.rb +0 -27
- data/spec/knapsack_pro/repository_adapters/git_adapter_spec.rb +0 -106
- data/spec/knapsack_pro/runners/base_runner_spec.rb +0 -87
- data/spec/knapsack_pro/runners/cucumber_runner_spec.rb +0 -92
- data/spec/knapsack_pro/runners/minitest_runner_spec.rb +0 -57
- data/spec/knapsack_pro/runners/queue/base_runner_spec.rb +0 -73
- data/spec/knapsack_pro/runners/queue/cucumber_runner_spec.rb +0 -209
- data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +0 -203
- data/spec/knapsack_pro/runners/rspec_runner_spec.rb +0 -111
- data/spec/knapsack_pro/runners/spinach_runner_spec.rb +0 -56
- data/spec/knapsack_pro/runners/test_unit_runner_spec.rb +0 -62
- data/spec/knapsack_pro/slow_test_file_determiner_spec.rb +0 -119
- data/spec/knapsack_pro/slow_test_file_finder_spec.rb +0 -42
- data/spec/knapsack_pro/task_loader_spec.rb +0 -14
- data/spec/knapsack_pro/test_case_detectors/rspec_test_example_detector_spec.rb +0 -217
- data/spec/knapsack_pro/test_case_mergers/base_merger_spec.rb +0 -27
- data/spec/knapsack_pro/test_case_mergers/rspec_merger_spec.rb +0 -81
- data/spec/knapsack_pro/test_file_cleaner_spec.rb +0 -11
- data/spec/knapsack_pro/test_file_finder_spec.rb +0 -176
- data/spec/knapsack_pro/test_file_pattern_spec.rb +0 -49
- data/spec/knapsack_pro/test_file_presenter_spec.rb +0 -22
- data/spec/knapsack_pro/test_files_with_test_cases_composer_spec.rb +0 -41
- data/spec/knapsack_pro/test_flat_distributor_spec.rb +0 -60
- data/spec/knapsack_pro/tracker_spec.rb +0 -184
- data/spec/knapsack_pro/utils_spec.rb +0 -55
- data/spec/knapsack_pro_spec.rb +0 -116
- data/spec/spec_helper.rb +0 -47
- data/spec/support/.gitkeep +0 -0
- data/spec/support/fakes/cucumber.rb +0 -25
- data/spec/support/fakes/minitest.rb +0 -18
- data/spec/support/shared_examples/adapter.rb +0 -17
- data/spec_fake/controllers/users_controller_spec.rb +0 -0
- data/spec_fake/models/admin_spec.rb +0 -0
- data/spec_fake/models/user_spec.rb +0 -0
- data/spec_fake/spec_helper.rb +0 -0
- data/spec_time_tracker/spec_helper.rb +0 -29
- data/test_fake/a_test.rb +0 -0
- data/test_fake/b_test.rb +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
describe KnapsackPro::Config::CI::Buildkite do
|
|
2
|
-
let(:env) { {} }
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const('ENV', env)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it { should be_kind_of KnapsackPro::Config::CI::Base }
|
|
9
|
-
|
|
10
|
-
describe '#node_total' do
|
|
11
|
-
subject { described_class.new.node_total }
|
|
12
|
-
|
|
13
|
-
context 'when the environment exists' do
|
|
14
|
-
let(:env) { { 'BUILDKITE_PARALLEL_JOB_COUNT' => 4 } }
|
|
15
|
-
it { should eql 4 }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "when the environment doesn't exist" do
|
|
19
|
-
it { should be nil }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe '#node_index' do
|
|
24
|
-
subject { described_class.new.node_index }
|
|
25
|
-
|
|
26
|
-
context 'when the environment exists' do
|
|
27
|
-
let(:env) { { 'BUILDKITE_PARALLEL_JOB' => 3 } }
|
|
28
|
-
it { should eql 3 }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "when the environment doesn't exist" do
|
|
32
|
-
it { should be nil }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe '#node_build_id' do
|
|
37
|
-
subject { described_class.new.node_build_id }
|
|
38
|
-
|
|
39
|
-
context 'when the environment exists' do
|
|
40
|
-
let(:env) { { 'BUILDKITE_BUILD_NUMBER' => 1514 } }
|
|
41
|
-
it { should eql 1514 }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context "when the environment doesn't exist" do
|
|
45
|
-
it { should be nil }
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe '#node_retry_count' do
|
|
50
|
-
subject { described_class.new.node_retry_count }
|
|
51
|
-
|
|
52
|
-
context 'when the environment exists' do
|
|
53
|
-
let(:env) { { 'BUILDKITE_RETRY_COUNT' => '1' } }
|
|
54
|
-
it { should eql '1' }
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
context "when the environment doesn't exist" do
|
|
58
|
-
it { should be nil }
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe '#commit_hash' do
|
|
63
|
-
subject { described_class.new.commit_hash }
|
|
64
|
-
|
|
65
|
-
context 'when the environment exists' do
|
|
66
|
-
let(:env) { { 'BUILDKITE_COMMIT' => '3fa64859337f6e56409d49f865d13fd7' } }
|
|
67
|
-
it { should eql '3fa64859337f6e56409d49f865d13fd7' }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context "when the environment doesn't exist" do
|
|
71
|
-
it { should be nil }
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe '#branch' do
|
|
76
|
-
subject { described_class.new.branch }
|
|
77
|
-
|
|
78
|
-
context 'when the environment exists' do
|
|
79
|
-
let(:env) { { 'BUILDKITE_BRANCH' => 'main' } }
|
|
80
|
-
it { should eql 'main' }
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "when the environment doesn't exist" do
|
|
84
|
-
it { should be nil }
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
describe '#project_dir' do
|
|
89
|
-
subject { described_class.new.project_dir }
|
|
90
|
-
|
|
91
|
-
context 'when the environment exists' do
|
|
92
|
-
let(:env) { { 'BUILDKITE_BUILD_CHECKOUT_PATH' => '/home/user/knapsack_pro-ruby' } }
|
|
93
|
-
it { should eql '/home/user/knapsack_pro-ruby' }
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
context "when the environment doesn't exist" do
|
|
97
|
-
it { should be nil }
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
describe '#user_seat' do
|
|
102
|
-
subject { described_class.new.user_seat }
|
|
103
|
-
|
|
104
|
-
context 'when the BUILDKITE_BUILD_AUTHOR env var exists' do
|
|
105
|
-
let(:env) do
|
|
106
|
-
{ 'BUILDKITE_BUILD_AUTHOR' => 'Jane Doe',
|
|
107
|
-
'BUILDKITE_BUILD_CREATOR' => nil }
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it { should eql 'Jane Doe' }
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
context 'when the BUILDKITE_BUILD_CREATOR env var exists' do
|
|
114
|
-
let(:env) do
|
|
115
|
-
{ 'BUILDKITE_BUILD_AUTHOR' => nil,
|
|
116
|
-
'BUILDKITE_BUILD_CREATOR' => 'John Doe' }
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it { should eql 'John Doe' }
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
context 'when both BUILDKITE_BUILD_AUTHOR and BUILDKITE_BUILD_CREATOR env vars exist' do
|
|
123
|
-
let(:env) do
|
|
124
|
-
{ 'BUILDKITE_BUILD_AUTHOR' => 'Jane Doe',
|
|
125
|
-
'BUILDKITE_BUILD_CREATOR' => 'John Doe' }
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
it { should eql 'Jane Doe' }
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
context "when neither env var exists" do
|
|
132
|
-
it { should be nil }
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
end
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
describe KnapsackPro::Config::CI::Circle do
|
|
2
|
-
let(:env) { {} }
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const('ENV', env)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it { should be_kind_of KnapsackPro::Config::CI::Base }
|
|
9
|
-
|
|
10
|
-
describe '#node_total' do
|
|
11
|
-
subject { described_class.new.node_total }
|
|
12
|
-
|
|
13
|
-
context 'when the environment exists' do
|
|
14
|
-
let(:env) { { 'CIRCLE_NODE_TOTAL' => 4 } }
|
|
15
|
-
it { should eql 4 }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "when the environment doesn't exist" do
|
|
19
|
-
it { should be nil }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe '#node_index' do
|
|
24
|
-
subject { described_class.new.node_index }
|
|
25
|
-
|
|
26
|
-
context 'when the environment exists' do
|
|
27
|
-
let(:env) { { 'CIRCLE_NODE_INDEX' => 3 } }
|
|
28
|
-
it { should eql 3 }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "when the environment doesn't exist" do
|
|
32
|
-
it { should be nil }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe '#node_build_id' do
|
|
37
|
-
subject { described_class.new.node_build_id }
|
|
38
|
-
|
|
39
|
-
context 'when the environment exists' do
|
|
40
|
-
let(:env) { { 'CIRCLE_BUILD_NUM' => 123 } }
|
|
41
|
-
it { should eql 123 }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context "when the environment doesn't exist" do
|
|
45
|
-
it { should be nil }
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe '#commit_hash' do
|
|
50
|
-
subject { described_class.new.commit_hash }
|
|
51
|
-
|
|
52
|
-
context 'when the environment exists' do
|
|
53
|
-
let(:env) { { 'CIRCLE_SHA1' => '3fa64859337f6e56409d49f865d13fd7' } }
|
|
54
|
-
it { should eql '3fa64859337f6e56409d49f865d13fd7' }
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
context "when the environment doesn't exist" do
|
|
58
|
-
it { should be nil }
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe '#branch' do
|
|
63
|
-
subject { described_class.new.branch }
|
|
64
|
-
|
|
65
|
-
context 'when the environment exists' do
|
|
66
|
-
let(:env) { { 'CIRCLE_BRANCH' => 'main' } }
|
|
67
|
-
it { should eql 'main' }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context "when the environment doesn't exist" do
|
|
71
|
-
it { should be nil }
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe '#project_dir' do
|
|
76
|
-
subject { described_class.new.project_dir }
|
|
77
|
-
|
|
78
|
-
context 'when CIRCLE_WORKING_DIRECTORY environment variable exists' do
|
|
79
|
-
let(:env) { { 'CIRCLE_WORKING_DIRECTORY' => '~/knapsack_pro-ruby' } }
|
|
80
|
-
it { should eql '~/knapsack_pro-ruby' }
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "when the environment doesn't exist" do
|
|
84
|
-
it { should be nil }
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
describe '#user_seat' do
|
|
89
|
-
subject { described_class.new.user_seat }
|
|
90
|
-
|
|
91
|
-
context 'when the CIRCLE_USERNAME env var exists' do
|
|
92
|
-
let(:env) do
|
|
93
|
-
{ 'CIRCLE_USERNAME' => 'Jane Doe',
|
|
94
|
-
'CIRCLE_PR_USERNAME' => nil }
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
it { should eql 'Jane Doe' }
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
context 'when the CIRCLE_PR_USERNAME env var exists' do
|
|
101
|
-
let(:env) do
|
|
102
|
-
{ 'CIRCLE_USERNAME' => nil,
|
|
103
|
-
'CIRCLE_PR_USERNAME' => 'John Doe' }
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it { should eql 'John Doe' }
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
context 'when both CIRCLE_USERNAME and CIRCLE_PR_USERNAME env vars exist' do
|
|
110
|
-
let(:env) do
|
|
111
|
-
{ 'CIRCLE_USERNAME' => 'Jane Doe',
|
|
112
|
-
'CIRCLE_PR_USERNAME' => 'John Doe' }
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
it { should eql 'Jane Doe' }
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
context "when neither env var exists" do
|
|
119
|
-
it { should be nil }
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
describe KnapsackPro::Config::CI::CirrusCI do
|
|
2
|
-
let(:env) { {} }
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const('ENV', env)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it { should be_kind_of KnapsackPro::Config::CI::Base }
|
|
9
|
-
|
|
10
|
-
describe '#node_total' do
|
|
11
|
-
subject { described_class.new.node_total }
|
|
12
|
-
|
|
13
|
-
context 'when the environment exists' do
|
|
14
|
-
let(:env) { { 'CI_NODE_TOTAL' => 4 } }
|
|
15
|
-
it { should eql 4 }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "when the environment doesn't exist" do
|
|
19
|
-
it { should be nil }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe '#node_index' do
|
|
24
|
-
subject { described_class.new.node_index }
|
|
25
|
-
|
|
26
|
-
context 'when the environment exists' do
|
|
27
|
-
let(:env) { { 'CI_NODE_INDEX' => 3 } }
|
|
28
|
-
it { should eql 3 }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "when the environment doesn't exist" do
|
|
32
|
-
it { should be nil }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe '#node_build_id' do
|
|
37
|
-
subject { described_class.new.node_build_id }
|
|
38
|
-
|
|
39
|
-
context 'when the environment exists' do
|
|
40
|
-
let(:env) { { 'CIRRUS_BUILD_ID' => 123 } }
|
|
41
|
-
it { should eql 123 }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context "when the environment doesn't exist" do
|
|
45
|
-
it { should be nil }
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe '#commit_hash' do
|
|
50
|
-
subject { described_class.new.commit_hash }
|
|
51
|
-
|
|
52
|
-
context 'when the environment exists' do
|
|
53
|
-
let(:env) { { 'CIRRUS_CHANGE_IN_REPO' => '2e13512fc230d6f9ebf4923352718e4d' } }
|
|
54
|
-
it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
context "when the environment doesn't exist" do
|
|
58
|
-
it { should be nil }
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe '#branch' do
|
|
63
|
-
subject { described_class.new.branch }
|
|
64
|
-
|
|
65
|
-
context 'when the environment exists' do
|
|
66
|
-
let(:env) { { 'CIRRUS_BRANCH' => 'main' } }
|
|
67
|
-
it { should eql 'main' }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context "when the environment doesn't exist" do
|
|
71
|
-
it { should be nil }
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe '#project_dir' do
|
|
76
|
-
subject { described_class.new.project_dir }
|
|
77
|
-
|
|
78
|
-
context 'when the environment exists' do
|
|
79
|
-
let(:env) { { 'CIRRUS_WORKING_DIR' => '/tmp/cirrus-ci-build' } }
|
|
80
|
-
it { should eql '/tmp/cirrus-ci-build' }
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "when the environment doesn't exist" do
|
|
84
|
-
it { should be nil }
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
describe KnapsackPro::Config::CI::Codefresh do
|
|
2
|
-
let(:env) { {} }
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const('ENV', env)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it { should be_kind_of KnapsackPro::Config::CI::Base }
|
|
9
|
-
|
|
10
|
-
describe '#node_total' do
|
|
11
|
-
subject { described_class.new.node_total }
|
|
12
|
-
|
|
13
|
-
it { should be nil }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '#node_index' do
|
|
17
|
-
subject { described_class.new.node_index }
|
|
18
|
-
|
|
19
|
-
it { should be nil }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe '#node_build_id' do
|
|
23
|
-
subject { described_class.new.node_build_id }
|
|
24
|
-
|
|
25
|
-
context 'when the environment exists' do
|
|
26
|
-
let(:env) { { 'CF_BUILD_ID' => '1005' } }
|
|
27
|
-
it { should eql '1005' }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "when the environment doesn't exist" do
|
|
31
|
-
it { should be nil }
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe '#commit_hash' do
|
|
36
|
-
subject { described_class.new.commit_hash }
|
|
37
|
-
|
|
38
|
-
context 'when the environment exists' do
|
|
39
|
-
let(:env) { { 'CF_REVISION' => 'b624067a61d2134df1db74ebdabb1d8d' } }
|
|
40
|
-
it { should eql 'b624067a61d2134df1db74ebdabb1d8d' }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "when the environment doesn't exist" do
|
|
44
|
-
it { should be nil }
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe '#branch' do
|
|
49
|
-
subject { described_class.new.branch }
|
|
50
|
-
|
|
51
|
-
context 'when the environment exists' do
|
|
52
|
-
let(:env) { { 'CF_BRANCH' => 'codefresh-branch' } }
|
|
53
|
-
it { should eql 'codefresh-branch' }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when the environment doesn't exist" do
|
|
57
|
-
it { should be nil }
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe '#project_dir' do
|
|
62
|
-
subject { described_class.new.project_dir }
|
|
63
|
-
|
|
64
|
-
it { should be nil }
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
describe '#user_seat' do
|
|
69
|
-
subject { described_class.new.user_seat }
|
|
70
|
-
|
|
71
|
-
context 'when the CF_BUILD_INITIATOR environment variable exists' do
|
|
72
|
-
let(:env) { { 'CF_BUILD_INITIATOR' => 'jane_doe' } }
|
|
73
|
-
|
|
74
|
-
it { should eql 'jane_doe' }
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
context "when the CF_BUILD_INITIATOR environment variable doesn't exist" do
|
|
78
|
-
it { should be nil }
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
describe KnapsackPro::Config::CI::Codeship do
|
|
2
|
-
let(:env) { {} }
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const('ENV', env)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it { should be_kind_of KnapsackPro::Config::CI::Base }
|
|
9
|
-
|
|
10
|
-
describe '#node_total' do
|
|
11
|
-
subject { described_class.new.node_total }
|
|
12
|
-
|
|
13
|
-
it { should be nil }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '#node_index' do
|
|
17
|
-
subject { described_class.new.node_index }
|
|
18
|
-
|
|
19
|
-
it { should be nil }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe '#node_build_id' do
|
|
23
|
-
subject { described_class.new.node_build_id }
|
|
24
|
-
|
|
25
|
-
context 'when the environment exists' do
|
|
26
|
-
let(:env) { { 'CI_BUILD_NUMBER' => 2013 } }
|
|
27
|
-
it { should eql 2013 }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "when the environment doesn't exist" do
|
|
31
|
-
it { should be nil }
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe '#commit_hash' do
|
|
36
|
-
subject { described_class.new.commit_hash }
|
|
37
|
-
|
|
38
|
-
context 'when the environment exists' do
|
|
39
|
-
let(:env) { { 'CI_COMMIT_ID' => 'a22aec3ee5d334fd658da35646b42bc5' } }
|
|
40
|
-
it { should eql 'a22aec3ee5d334fd658da35646b42bc5' }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "when the environment doesn't exist" do
|
|
44
|
-
it { should be nil }
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe '#branch' do
|
|
49
|
-
subject { described_class.new.branch }
|
|
50
|
-
|
|
51
|
-
context 'when the environment exists' do
|
|
52
|
-
let(:env) { { 'CI_BRANCH' => 'main' } }
|
|
53
|
-
it { should eql 'main' }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when the environment doesn't exist" do
|
|
57
|
-
it { should be nil }
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe '#project_dir' do
|
|
62
|
-
subject { described_class.new.project_dir }
|
|
63
|
-
|
|
64
|
-
it { should be nil }
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe '#user_seat' do
|
|
68
|
-
subject { described_class.new.user_seat }
|
|
69
|
-
|
|
70
|
-
context 'when the CI_COMMITTER_NAME environment variable exists' do
|
|
71
|
-
let(:env) { { 'CI_COMMITTER_NAME' => 'jane_doe' } }
|
|
72
|
-
|
|
73
|
-
it { should eql 'jane_doe' }
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
context "when the CI_COMMITTER_NAME environment variable doesn't exist" do
|
|
77
|
-
it { should be nil }
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
describe KnapsackPro::Config::CI::GithubActions do
|
|
2
|
-
let(:env) { {} }
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const('ENV', env)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it { should be_kind_of KnapsackPro::Config::CI::Base }
|
|
9
|
-
|
|
10
|
-
describe '#node_total' do
|
|
11
|
-
subject { described_class.new.node_total }
|
|
12
|
-
|
|
13
|
-
it { should be nil }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '#node_index' do
|
|
17
|
-
subject { described_class.new.node_index }
|
|
18
|
-
|
|
19
|
-
it { should be nil }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe '#node_build_id' do
|
|
23
|
-
subject { described_class.new.node_build_id }
|
|
24
|
-
|
|
25
|
-
context 'when the environment exists' do
|
|
26
|
-
let(:env) { { 'GITHUB_RUN_ID' => 2706 } }
|
|
27
|
-
it { should eql 2706 }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "when the environment doesn't exist" do
|
|
31
|
-
it { should be nil }
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe '#node_retry_count' do
|
|
36
|
-
subject { described_class.new.node_retry_count }
|
|
37
|
-
|
|
38
|
-
context 'when the environment exists' do
|
|
39
|
-
let(:env) { { 'GITHUB_RUN_ATTEMPT' => 2 } }
|
|
40
|
-
it { should eql 1 }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "when the environment doesn't exist" do
|
|
44
|
-
it { should be nil }
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe '#commit_hash' do
|
|
49
|
-
subject { described_class.new.commit_hash }
|
|
50
|
-
|
|
51
|
-
context 'when the environment exists' do
|
|
52
|
-
let(:env) { { 'GITHUB_SHA' => '2e13512fc230d6f9ebf4923352718e4d' } }
|
|
53
|
-
it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when the environment doesn't exist" do
|
|
57
|
-
it { should be nil }
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe '#branch' do
|
|
62
|
-
subject { described_class.new.branch }
|
|
63
|
-
|
|
64
|
-
context 'when GITHUB_HEAD_REF is set' do
|
|
65
|
-
let(:env) do
|
|
66
|
-
{
|
|
67
|
-
'GITHUB_HEAD_REF' => 'feature',
|
|
68
|
-
'GITHUB_REF_NAME' => 'main',
|
|
69
|
-
'GITHUB_SHA' => '2e13512fc230d6f9ebf4923352718e4d'
|
|
70
|
-
}
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it { should eql 'feature' }
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
context 'when GITHUB_REF_NAME is set' do
|
|
77
|
-
let(:env) do
|
|
78
|
-
{
|
|
79
|
-
'GITHUB_REF_NAME' => 'main',
|
|
80
|
-
'GITHUB_SHA' => '2e13512fc230d6f9ebf4923352718e4d'
|
|
81
|
-
}
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it { should eql 'main' }
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
context 'when GITHUB_HEAD_REF is set to empty string' do
|
|
88
|
-
let(:env) do
|
|
89
|
-
{
|
|
90
|
-
'GITHUB_HEAD_REF' => '',
|
|
91
|
-
'GITHUB_REF_NAME' => 'main',
|
|
92
|
-
'GITHUB_SHA' => '2e13512fc230d6f9ebf4923352718e4d'
|
|
93
|
-
}
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it { should eql 'main' }
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
context 'when GITHUB_SHA is set' do
|
|
100
|
-
let(:env) do
|
|
101
|
-
{
|
|
102
|
-
'GITHUB_SHA' => '2e13512fc230d6f9ebf4923352718e4d'
|
|
103
|
-
}
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
context 'with no ENVs' do
|
|
110
|
-
it { should be nil }
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
describe '#project_dir' do
|
|
115
|
-
subject { described_class.new.project_dir }
|
|
116
|
-
|
|
117
|
-
context 'when the environment exists' do
|
|
118
|
-
let(:env) { { 'GITHUB_WORKSPACE' => '/home/runner/work/my-repo-name/my-repo-name' } }
|
|
119
|
-
it { should eql '/home/runner/work/my-repo-name/my-repo-name' }
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
context "when the environment doesn't exist" do
|
|
123
|
-
it { should be nil }
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
describe '#user_seat' do
|
|
128
|
-
subject { described_class.new.user_seat }
|
|
129
|
-
|
|
130
|
-
context 'when the GITHUB_ACTOR environment variable exists' do
|
|
131
|
-
let(:env) { { 'GITHUB_ACTOR' => 'jane_doe' } }
|
|
132
|
-
|
|
133
|
-
it { should eql 'jane_doe' }
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
context "when the GITHUB_ACTOR environment variable doesn't exist" do
|
|
137
|
-
it { should be nil }
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
end
|