summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorAdam Niedzielski <adamsunday@gmail.com>2016-12-16 13:24:03 +0100
committerAdam Niedzielski <adamsunday@gmail.com>2016-12-16 13:24:03 +0100
commitc945a0a7141ddf80e58e821178195cc48b8143f0 (patch)
tree9dcc3cdf890800b6c4a3ad006c04b0c1c2e6530a /spec/models/project_spec.rb
parent45bd2263698892b9de6eb7956e3085a61054f49f (diff)
downloadgitlab-ce-expose-deployment-variables.tar.gz
Pass variables from deployment project services to CI runnerexpose-deployment-variables
This commit introduces the concept of deployment variables - variables that are collected from deployment services and passed to CI runner during a deployment build. Deployment services specify the variables by overriding "predefined_variables" method. This commit also configures variables for KubernetesService
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 21ff238841e..c7d914a81f9 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1696,6 +1696,26 @@ describe Project, models: true do
end
end
+ describe '#deployment_variables' do
+ context 'when project has no deployment service' do
+ let(:project) { create(:empty_project) }
+
+ it 'returns an empty array' do
+ expect(project.deployment_variables).to eq []
+ end
+ end
+
+ context 'when project has a deployment service' do
+ let(:project) { create(:kubernetes_project) }
+
+ it 'returns variables from this service' do
+ expect(project.deployment_variables).to include(
+ { key: 'KUBE_TOKEN', value: project.kubernetes_service.token, public: false }
+ )
+ end
+ end
+ end
+
def enable_lfs
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
end