Skip to content
代码片段 群组 项目
未验证 提交 1163fcbd 编辑于 作者: Imre Farkas's avatar Imre Farkas 提交者: GitLab
浏览文件

Merge branch '442032-confidential-issue' into 'master'

No related branches found
No related tags found
加载中
...@@ -72,9 +72,14 @@ def testable? ...@@ -72,9 +72,14 @@ def testable?
def identity_provider_resource_name def identity_provider_resource_name
return unless parent.google_cloud_workload_identity_federation_enabled? && activated? return unless parent.google_cloud_workload_identity_federation_enabled? && activated?
"//iam.googleapis.com/projects/#{workload_identity_federation_project_number}/" \ "//#{identity_pool_resource_name}/providers/#{workload_identity_pool_provider_id}"
"locations/global/workloadIdentityPools/#{workload_identity_pool_id}/" \ end
"providers/#{workload_identity_pool_provider_id}"
def identity_pool_resource_name
return unless parent.google_cloud_workload_identity_federation_enabled? && activated?
"iam.googleapis.com/projects/#{workload_identity_federation_project_number}/" \
"locations/global/workloadIdentityPools/#{workload_identity_pool_id}"
end end
end end
end end
......
...@@ -126,4 +126,52 @@ ...@@ -126,4 +126,52 @@
end end
end end
end end
describe '#identity_pool_resource_name' do
using RSpec::Parameterized::TableSyntax
let_it_be(:group) { create(:group) }
let_it_be(:project_integration) { create(:google_cloud_platform_workload_identity_federation_integration) }
let_it_be(:group_integration) do
create(:google_cloud_platform_workload_identity_federation_integration, project: nil, group: group)
end
let(:resource_name) do
"iam.googleapis.com/projects/#{integration.workload_identity_federation_project_number}/" \
"locations/global/workloadIdentityPools/#{integration.workload_identity_pool_id}"
end
subject { integration.identity_pool_resource_name }
where(:integration, :active, :expected_resource_name) do
ref(:project_integration) | true | ref(:resource_name)
ref(:project_integration) | false | nil
ref(:group_integration) | true | ref(:resource_name)
ref(:group_integration) | false | nil
end
with_them do
before do
integration.update!(active: active) unless active
end
it { is_expected.to be_nil }
context 'when feature is available' do
before do
stub_saas_features(google_cloud_support: true)
end
it { is_expected.to eq(expected_resource_name) }
end
context 'when google_cloud_workload_identity_federation FF is disabled' do
before do
stub_feature_flags(google_cloud_workload_identity_federation: false)
end
it { is_expected.to be_nil }
end
end
end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册