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/services/deployments/update_environment_service_spec.rb')
-rw-r--r--spec/services/deployments/update_environment_service_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/services/deployments/update_environment_service_spec.rb b/spec/services/deployments/update_environment_service_spec.rb
index 6996563fdb8..0859aa2c9d1 100644
--- a/spec/services/deployments/update_environment_service_spec.rb
+++ b/spec/services/deployments/update_environment_service_spec.rb
@@ -286,6 +286,37 @@ RSpec.describe Deployments::UpdateEnvironmentService do
end
end
+ context 'when environment url uses a nested variable' do
+ let(:yaml_variables) do
+ [
+ { key: 'MAIN_DOMAIN', value: '${STACK_NAME}.example.com' },
+ { key: 'STACK_NAME', value: 'appname-${ENVIRONMENT_NAME}' },
+ { key: 'ENVIRONMENT_NAME', value: '${CI_COMMIT_REF_SLUG}' }
+ ]
+ end
+
+ let(:job) do
+ create(:ci_build,
+ :with_deployment,
+ pipeline: pipeline,
+ ref: 'master',
+ environment: 'production',
+ project: project,
+ yaml_variables: yaml_variables,
+ options: { environment: { name: 'production', url: 'http://$MAIN_DOMAIN' } })
+ end
+
+ it { is_expected.to eq('http://appname-master.example.com') }
+
+ context 'when the FF ci_expand_environment_name_and_url is disabled' do
+ before do
+ stub_feature_flags(ci_expand_environment_name_and_url: false)
+ end
+
+ it { is_expected.to eq('http://${STACK_NAME}.example.com') }
+ end
+ end
+
context 'when yaml environment does not have url' do
let(:job) { create(:ci_build, :with_deployment, pipeline: pipeline, environment: 'staging', project: project) }