knapsack_pro 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -2
- data/lib/knapsack_pro/config/ci/app_veyor.rb +8 -0
- data/lib/knapsack_pro/config/ci/base.rb +7 -0
- data/lib/knapsack_pro/config/ci/buildkite.rb +8 -0
- data/lib/knapsack_pro/config/ci/circle.rb +8 -0
- data/lib/knapsack_pro/config/ci/cirrus_ci.rb +8 -0
- data/lib/knapsack_pro/config/ci/codefresh.rb +8 -0
- data/lib/knapsack_pro/config/ci/codeship.rb +8 -0
- data/lib/knapsack_pro/config/ci/github_actions.rb +16 -0
- data/lib/knapsack_pro/config/ci/gitlab_ci.rb +8 -0
- data/lib/knapsack_pro/config/ci/heroku.rb +8 -0
- data/lib/knapsack_pro/config/ci/semaphore.rb +8 -0
- data/lib/knapsack_pro/config/ci/semaphore2.rb +9 -0
- data/lib/knapsack_pro/config/ci/travis.rb +8 -0
- data/lib/knapsack_pro/config/env.rb +20 -11
- data/lib/knapsack_pro/version.rb +1 -1
- data/lib/tasks/queue/cucumber.rake +5 -0
- data/lib/tasks/queue/minitest.rake +5 -0
- data/lib/tasks/queue/rspec.rake +5 -0
- data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +8 -8
- data/spec/knapsack_pro/config/ci/buildkite_spec.rb +14 -14
- data/spec/knapsack_pro/config/ci/circle_spec.rb +11 -11
- data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/codefresh_spec.rb +6 -6
- data/spec/knapsack_pro/config/ci/codeship_spec.rb +6 -6
- data/spec/knapsack_pro/config/ci/github_actions_spec.rb +21 -8
- data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +9 -9
- data/spec/knapsack_pro/config/ci/heroku_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +11 -11
- data/spec/knapsack_pro/config/ci/semaphore_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/travis_spec.rb +8 -8
- data/spec/knapsack_pro/config/env_spec.rb +102 -87
- metadata +3 -3
@@ -632,20 +632,6 @@ describe KnapsackPro::Config::Env do
|
|
632
632
|
end
|
633
633
|
end
|
634
634
|
|
635
|
-
describe '.fixed_test_suite_split' do
|
636
|
-
subject { described_class.fixed_test_suite_split }
|
637
|
-
|
638
|
-
context 'when ENV exists' do
|
639
|
-
before { stub_const("ENV", { 'KNAPSACK_PRO_FIXED_TEST_SUITE_SPLIT' => false }) }
|
640
|
-
it { should eq false }
|
641
|
-
end
|
642
|
-
|
643
|
-
context "when ENV doesn't exist" do
|
644
|
-
before { stub_const("ENV", {}) }
|
645
|
-
it { should be true }
|
646
|
-
end
|
647
|
-
end
|
648
|
-
|
649
635
|
describe '.fixed_test_suite_split?' do
|
650
636
|
subject { described_class.fixed_test_suite_split? }
|
651
637
|
|
@@ -667,38 +653,94 @@ describe KnapsackPro::Config::Env do
|
|
667
653
|
end
|
668
654
|
end
|
669
655
|
|
670
|
-
describe '.fixed_queue_split' do
|
671
|
-
subject { described_class.fixed_queue_split }
|
672
|
-
|
673
|
-
context 'when ENV exists' do
|
674
|
-
before { stub_const("ENV", { 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => true }) }
|
675
|
-
it { should eq true }
|
676
|
-
end
|
677
|
-
|
678
|
-
context "when ENV doesn't exist" do
|
679
|
-
before { stub_const("ENV", {}) }
|
680
|
-
it { should be false }
|
681
|
-
end
|
682
|
-
end
|
683
|
-
|
684
656
|
describe '.fixed_queue_split?' do
|
685
657
|
subject { described_class.fixed_queue_split? }
|
658
|
+
after(:each) { described_class.remove_instance_variable(:@fixed_queue_split) }
|
686
659
|
|
687
660
|
context 'when ENV exists' do
|
688
|
-
context 'when KNAPSACK_PRO_FIXED_QUEUE_SPLIT=
|
689
|
-
|
690
|
-
|
661
|
+
context 'when KNAPSACK_PRO_FIXED_QUEUE_SPLIT=false' do
|
662
|
+
[
|
663
|
+
['AppVeyor', { 'APPVEYOR' => '123' }],
|
664
|
+
['Buildkite', { 'BUILDKITE' => 'true' }],
|
665
|
+
['CircleCI', { 'CIRCLECI' => 'true' }],
|
666
|
+
['Cirrus CI', { 'CIRRUS_CI' => 'true' }],
|
667
|
+
['Codefresh', { 'CF_BUILD_ID' => '123' }],
|
668
|
+
['Codeship', { 'CI_NAME' => 'codeship' }],
|
669
|
+
['GitHub Actions', { 'GITHUB_ACTIONS' => 'true' }],
|
670
|
+
['GitLab CI', { 'GITLAB_CI' => 'true' }],
|
671
|
+
['Heroku CI', { 'HEROKU_TEST_RUN_ID' => '123' }],
|
672
|
+
['Semaphore CI 1.0', { 'SEMAPHORE_BUILD_NUMBER' => '123' }],
|
673
|
+
['Semaphore CI 2.0', { 'SEMAPHORE' => 'true', 'SEMAPHORE_WORKFLOW_ID' => '123' }],
|
674
|
+
['Travis CI', { 'TRAVIS' => 'true' }],
|
675
|
+
['Unsupported', {}],
|
676
|
+
].each do |ci, env|
|
677
|
+
it "on #{ci} it is false" do
|
678
|
+
logger = instance_double(Logger)
|
679
|
+
allow(KnapsackPro).to receive(:logger).and_return(logger)
|
680
|
+
expect(logger).not_to receive(:info)
|
681
|
+
|
682
|
+
stub_const("ENV", env.merge({ 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => 'false' }))
|
683
|
+
|
684
|
+
expect(subject).to eq(false)
|
685
|
+
end
|
686
|
+
end
|
691
687
|
end
|
692
688
|
|
693
|
-
context 'when KNAPSACK_PRO_FIXED_QUEUE_SPLIT=
|
694
|
-
|
695
|
-
|
689
|
+
context 'when KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true' do
|
690
|
+
[
|
691
|
+
['AppVeyor', { 'APPVEYOR' => '123' }],
|
692
|
+
['Buildkite', { 'BUILDKITE' => 'true' }],
|
693
|
+
['CircleCI', { 'CIRCLECI' => 'true' }],
|
694
|
+
['Cirrus CI', { 'CIRRUS_CI' => 'true' }],
|
695
|
+
['Codefresh', { 'CF_BUILD_ID' => '123' }],
|
696
|
+
['Codeship', { 'CI_NAME' => 'codeship' }],
|
697
|
+
['GitHub Actions', { 'GITHUB_ACTIONS' => 'true' }],
|
698
|
+
['GitLab CI', { 'GITLAB_CI' => 'true' }],
|
699
|
+
['Heroku CI', { 'HEROKU_TEST_RUN_ID' => '123' }],
|
700
|
+
['Semaphore CI 1.0', { 'SEMAPHORE_BUILD_NUMBER' => '123' }],
|
701
|
+
['Semaphore CI 2.0', { 'SEMAPHORE' => 'true', 'SEMAPHORE_WORKFLOW_ID' => '123' }],
|
702
|
+
['Travis CI', { 'TRAVIS' => 'true' }],
|
703
|
+
['Unsupported', {}],
|
704
|
+
].each do |ci, env|
|
705
|
+
it "on #{ci} it is true" do
|
706
|
+
logger = instance_double(Logger)
|
707
|
+
allow(KnapsackPro).to receive(:logger).and_return(logger)
|
708
|
+
expect(logger).not_to receive(:info)
|
709
|
+
|
710
|
+
stub_const("ENV", env.merge({ 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => 'true' }))
|
711
|
+
|
712
|
+
expect(subject).to eq(true)
|
713
|
+
end
|
714
|
+
end
|
696
715
|
end
|
697
716
|
end
|
698
717
|
|
699
718
|
context "when ENV doesn't exist" do
|
700
|
-
|
701
|
-
|
719
|
+
[
|
720
|
+
['AppVeyor', { 'APPVEYOR' => '123' }, false],
|
721
|
+
['Buildkite', { 'BUILDKITE' => 'true' }, true],
|
722
|
+
['CircleCI', { 'CIRCLECI' => 'true' }, false],
|
723
|
+
['Cirrus CI', { 'CIRRUS_CI' => 'true' }, false],
|
724
|
+
['Codefresh', { 'CF_BUILD_ID' => '123' }, false],
|
725
|
+
['Codeship', { 'CI_NAME' => 'codeship' }, true],
|
726
|
+
['GitHub Actions', { 'GITHUB_ACTIONS' => 'true' }, true],
|
727
|
+
['GitLab CI', { 'GITLAB_CI' => 'true' }, false],
|
728
|
+
['Heroku CI', { 'HEROKU_TEST_RUN_ID' => '123' }, false],
|
729
|
+
['Semaphore CI 1.0', { 'SEMAPHORE_BUILD_NUMBER' => '123' }, false],
|
730
|
+
['Semaphore CI 2.0', { 'SEMAPHORE' => 'true', 'SEMAPHORE_WORKFLOW_ID' => '123' }, false],
|
731
|
+
['Travis CI', { 'TRAVIS' => 'true' }, true],
|
732
|
+
['Unsupported', {}, true],
|
733
|
+
].each do |ci, env, expected|
|
734
|
+
it "on #{ci} it is #{expected}" do
|
735
|
+
logger = instance_double(Logger)
|
736
|
+
expect(KnapsackPro).to receive(:logger).and_return(logger)
|
737
|
+
expect(logger).to receive(:info).with("KNAPSACK_PRO_FIXED_QUEUE_SPLIT is not set. Using default value: #{expected}. Learn more at #{KnapsackPro::Urls::FIXED_QUEUE_SPLIT}")
|
738
|
+
|
739
|
+
stub_const("ENV", env)
|
740
|
+
|
741
|
+
expect(subject).to eq(expected)
|
742
|
+
end
|
743
|
+
end
|
702
744
|
end
|
703
745
|
end
|
704
746
|
|
@@ -895,57 +937,6 @@ describe KnapsackPro::Config::Env do
|
|
895
937
|
end
|
896
938
|
end
|
897
939
|
|
898
|
-
describe '.ci_env_for' do
|
899
|
-
let(:env_name) { :node_total }
|
900
|
-
|
901
|
-
subject { described_class.ci_env_for(env_name) }
|
902
|
-
|
903
|
-
context 'when CI has no value for env_name method' do
|
904
|
-
before do
|
905
|
-
expect(KnapsackPro::Config::CI::Circle).to receive_message_chain(:new, env_name).and_return(nil)
|
906
|
-
expect(KnapsackPro::Config::CI::Semaphore).to receive_message_chain(:new, env_name).and_return(nil)
|
907
|
-
expect(KnapsackPro::Config::CI::Buildkite).to receive_message_chain(:new, env_name).and_return(nil)
|
908
|
-
end
|
909
|
-
|
910
|
-
it do
|
911
|
-
expect(subject).to be_nil
|
912
|
-
end
|
913
|
-
end
|
914
|
-
|
915
|
-
context 'when CI has value for env_name method' do
|
916
|
-
let(:circle_env) { double(:circle) }
|
917
|
-
let(:semaphore_env) { double(:semaphore) }
|
918
|
-
let(:buildkite_env) { double(:buildkite) }
|
919
|
-
|
920
|
-
before do
|
921
|
-
allow(KnapsackPro::Config::CI::Circle).to receive_message_chain(:new, env_name).and_return(circle_env)
|
922
|
-
allow(KnapsackPro::Config::CI::Semaphore).to receive_message_chain(:new, env_name).and_return(semaphore_env)
|
923
|
-
allow(KnapsackPro::Config::CI::Buildkite).to receive_message_chain(:new, env_name).and_return(buildkite_env)
|
924
|
-
end
|
925
|
-
|
926
|
-
context do
|
927
|
-
let(:buildkite_env) { nil }
|
928
|
-
let(:semaphore_env) { nil }
|
929
|
-
|
930
|
-
it { should eq circle_env }
|
931
|
-
end
|
932
|
-
|
933
|
-
context do
|
934
|
-
let(:circle_env) { nil }
|
935
|
-
let(:buildkite_env) { nil }
|
936
|
-
|
937
|
-
it { should eq semaphore_env }
|
938
|
-
end
|
939
|
-
|
940
|
-
context do
|
941
|
-
let(:circle_env) { nil }
|
942
|
-
let(:semaphore_env) { nil }
|
943
|
-
|
944
|
-
it { should eq buildkite_env }
|
945
|
-
end
|
946
|
-
end
|
947
|
-
end
|
948
|
-
|
949
940
|
describe '.log_level' do
|
950
941
|
subject { described_class.log_level }
|
951
942
|
|
@@ -1022,4 +1013,28 @@ describe KnapsackPro::Config::Env do
|
|
1022
1013
|
expect(described_class.test_runner_adapter).to eql 'RSpecAdapter'
|
1023
1014
|
end
|
1024
1015
|
end
|
1016
|
+
|
1017
|
+
describe '.detected_ci' do
|
1018
|
+
[
|
1019
|
+
['AppVeyor', { 'APPVEYOR' => '123' }, KnapsackPro::Config::CI::AppVeyor],
|
1020
|
+
['Buildkite', { 'BUILDKITE' => 'true' }, KnapsackPro::Config::CI::Buildkite],
|
1021
|
+
['CircleCI', { 'CIRCLECI' => 'true' }, KnapsackPro::Config::CI::Circle],
|
1022
|
+
['Cirrus CI', { 'CIRRUS_CI' => 'true' }, KnapsackPro::Config::CI::CirrusCI],
|
1023
|
+
['Codefresh', { 'CF_BUILD_ID' => '123' }, KnapsackPro::Config::CI::Codefresh],
|
1024
|
+
['Codeship', { 'CI_NAME' => 'codeship' }, KnapsackPro::Config::CI::Codeship],
|
1025
|
+
['GitHub Actions', { 'GITHUB_ACTIONS' => 'true' }, KnapsackPro::Config::CI::GithubActions],
|
1026
|
+
['GitLab CI', { 'GITLAB_CI' => 'true' }, KnapsackPro::Config::CI::GitlabCI],
|
1027
|
+
['Heroku CI', { 'HEROKU_TEST_RUN_ID' => '123' }, KnapsackPro::Config::CI::Heroku],
|
1028
|
+
['Semaphore CI 1.0', { 'SEMAPHORE_BUILD_NUMBER' => '123' }, KnapsackPro::Config::CI::Semaphore],
|
1029
|
+
['Semaphore CI 2.0', { 'SEMAPHORE' => 'true', 'SEMAPHORE_WORKFLOW_ID' => '123' }, KnapsackPro::Config::CI::Semaphore2],
|
1030
|
+
['Travis CI', { 'TRAVIS' => 'true' }, KnapsackPro::Config::CI::Travis],
|
1031
|
+
['Unsupported', {}, KnapsackPro::Config::CI::Base],
|
1032
|
+
].each do |ci, env, expected|
|
1033
|
+
it "detects #{ci}" do
|
1034
|
+
stub_const("ENV", env)
|
1035
|
+
|
1036
|
+
expect(described_class.detected_ci).to eq(expected)
|
1037
|
+
end
|
1038
|
+
end
|
1039
|
+
end
|
1025
1040
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -404,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
404
404
|
- !ruby/object:Gem::Version
|
405
405
|
version: '0'
|
406
406
|
requirements: []
|
407
|
-
rubygems_version: 3.4.
|
407
|
+
rubygems_version: 3.4.10
|
408
408
|
signing_key:
|
409
409
|
specification_version: 4
|
410
410
|
summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
|