Commit eef96832 authored by Shinya Maeda's avatar Shinya Maeda

Add test for deployment_variables

parent db676b9f
......@@ -707,7 +707,7 @@ describe Project do
let(:project) { create(:project) }
context 'when environment is specified' do
let(:environment) { create(:environment, name: 'review/name') }
let(:environment) { create(:environment, project: project, name: 'review/name') }
let!(:default_cluster) { create(:cluster, :provided_by_user, projects: [project], environment_scope: '*') }
let!(:cluster) { create(:cluster, :provided_by_user, projects: [project]) }
......
......@@ -2384,6 +2384,49 @@ describe Project do
it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes'
end
context 'when multiple clusters (EEP) is enabled' do
before do
stub_licensed_features(multiple_clusters: true)
end
let(:project) { create(:project) }
let!(:default_cluster) do
create(:cluster, platform_type: :kubernetes, projects: [project],
environment_scope: '*', platform_kubernetes: default_cluster_kubernetes)
end
let!(:review_env_cluster) do
create(:cluster, platform_type: :kubernetes, projects: [project],
environment_scope: 'review/*', platform_kubernetes: review_env_cluster_kubernetes)
end
let(:default_cluster_kubernetes) { create(:cluster_platform_kubernetes, token: 'default-AAA') }
let(:review_env_cluster_kubernetes) { create(:cluster_platform_kubernetes, token: 'review-AAA') }
subject { project.deployment_variables(environment: environment) }
context 'when environment name is review/name' do
let!(:environment) { create(:environment, project: project, name: 'review/name') }
it 'returns variables from this service' do
expect(subject).to include(
{ key: 'KUBE_TOKEN', value: 'review-AAA', public: false }
)
end
end
context 'when environment name is other' do
let!(:environment) { create(:environment, project: project, name: 'staging/name') }
it 'returns variables from this service' do
expect(subject).to include(
{ key: 'KUBE_TOKEN', value: 'default-AAA', public: false }
)
end
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment