Fix oidc's vim not applied to FT

This patch modifies the task replacement rules in set-default-vim,
enabling zuul to create kubernetes vim using oidc. At the same time,
the FT code of v1-related oidc is modified so that it can use
oidc-related vim during testing.

Closes-Bug: #2007054
Change-Id: Idc27bd2609582ed949041d2f8c730eec686f5102
This commit is contained in:
Shuwen Cai 2023-02-13 15:13:57 +09:00
parent 46a28fc8a2
commit 7d7d6f1d5b
3 changed files with 16 additions and 4 deletions

View File

@ -264,8 +264,8 @@
- name: Replace the config file path in the test-setup-k8s-vim.sh
replace:
path: "{{ zuul_work_dir }}/tools/test-setup-k8s-vim.sh"
regexp: '(?<=config-file )([^ ]+)(?= )'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-k8s-vim.yaml"
regexp: '(?<=conf_dir=)([^\n]+)(?=\n)'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples"
- name: Run tools/test-setup-k8s-vim.sh
command: tools/test-setup-k8s-vim.sh

View File

@ -31,6 +31,18 @@ class VnfLcmKubernetesOidcTest(base.BaseVnfLcmKubernetesTest):
def tearDownClass(cls):
super(VnfLcmKubernetesOidcTest, cls).tearDownClass()
def setUp(self):
vim_list = self.client.list_vims()
if not vim_list:
self.skipTest("Vims are not configured")
vim_name = 'vim-kubernetes-oidc-auth'
vim = self.get_vim(vim_list, vim_name)
if not vim:
self.skipTest(f"Kubernetes VIM '{vim_name}' is missing")
self.vim_id = vim['id']
self.extra = vim['extra']
def test_basic_lcmsV1_with_oidc_auth(self):
"""Test CNF LCM with OIDC auth

View File

@ -34,7 +34,7 @@ register_vim() {
register_vim $conf_dir/local-k8s-vim.yaml vim-kubernetes
# regiter vim with OpenID Connect info
if [ -f $conf_dir/local-k8s-vim-oidc.yaml ]
if [ -f /tmp/keycloak.crt ]
then
register_vim $conf_dir/local-k8s-vim-oidc.yaml vim-kubernetes-oidc
fi
fi