Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/scripts/trigger-build_spec.rb')
-rw-r--r--spec/scripts/trigger-build_spec.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/scripts/trigger-build_spec.rb b/spec/scripts/trigger-build_spec.rb
index 3ac383e8d30..d3b520d385f 100644
--- a/spec/scripts/trigger-build_spec.rb
+++ b/spec/scripts/trigger-build_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe Trigger, feature_category: :tooling do
}
end
- let(:com_api_endpoint) { 'https://gitlab.com/api/v4' }
+ let(:com_api_endpoint) { Trigger::Base.new.send(:endpoint) }
let(:com_api_token) { env['PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE'] }
let(:com_gitlab_client) { double('com_gitlab_client') }
@@ -237,8 +237,14 @@ RSpec.describe Trigger, feature_category: :tooling do
describe "TRIGGER_BRANCH" do
context 'when CNG_BRANCH is not set' do
it 'sets TRIGGER_BRANCH to master' do
+ stub_env('CI_PROJECT_NAMESPACE', 'gitlab-org')
expect(subject.variables['TRIGGER_BRANCH']).to eq('master')
end
+
+ it 'sets TRIGGER_BRANCH to main-jh on JH side' do
+ stub_env('CI_PROJECT_NAMESPACE', 'gitlab-cn')
+ expect(subject.variables['TRIGGER_BRANCH']).to eq('main-jh')
+ end
end
context 'when CNG_BRANCH is set' do
@@ -261,6 +267,20 @@ RSpec.describe Trigger, feature_category: :tooling do
end
it 'sets TRIGGER_BRANCH to the corresponding stable branch' do
+ stub_env('CI_PROJECT_NAMESPACE', 'gitlab-org')
+ expect(subject.variables['TRIGGER_BRANCH']).to eq(ref)
+ end
+ end
+
+ context 'when CI_COMMIT_REF_NAME is a stable branch on JH side' do
+ let(:ref) { '14-10-stable' }
+
+ before do
+ stub_env('CI_COMMIT_REF_NAME', "#{ref}-jh")
+ end
+
+ it 'sets TRIGGER_BRANCH to the corresponding stable branch' do
+ stub_env('CI_PROJECT_NAMESPACE', 'gitlab-cn')
expect(subject.variables['TRIGGER_BRANCH']).to eq(ref)
end
end