@@ -105,6 +105,7 @@ schema=('rfc2307' 'ad' 'augmented-ad')
105
105
for (( i= 0 ; i< ${# schema[@]} ; i++ )) ; do
106
106
current_schema=${schema[$i]}
107
107
os::log::info " Testing schema: ${current_schema} "
108
+ os::test::junit::declare_suite_start " extended/ldap-groups/${current_schema} "
108
109
109
110
WORKINGDIR=${BASETMPDIR} /${current_schema}
110
111
mkdir ${WORKINGDIR}
@@ -209,6 +210,14 @@ for (( i=0; i<${#schema[@]}; i++ )); do
209
210
oc adm groups sync --sync-config=sync-config-dn-everywhere.yaml --confirm
210
211
compare_and_cleanup valid_all_ldap_sync_dn_everywhere.yaml
211
212
213
+ echo -e " \tTEST: Sync based on OpenShift groups respecting OpenShift mappings and whitelist file"
214
+ os::cmd::expect_success_and_text ' oc adm groups sync --whitelist=ldapgroupuids.txt --sync-config=sync-config-user-defined.yaml --confirm' ' group/'
215
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name}' ' firstgroup secondgroup thirdgroup'
216
+ os::cmd::expect_success_and_text ' oc adm groups sync --type=openshift --whitelist=ldapgroupuids.txt --sync-config=sync-config-user-defined.yaml --confirm' ' group/'
217
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name}' ' firstgroup secondgroup thirdgroup'
218
+ os::cmd::expect_success_and_text ' oc delete groups --all' ' deleted'
219
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name} | wc -l' ' 0'
220
+
212
221
213
222
# PRUNING
214
223
echo -e " \tTEST: Sync all LDAP groups from LDAP server, change LDAP UID, then prune OpenShift groups"
@@ -217,11 +226,25 @@ for (( i=0; i<${#schema[@]}; i++ )); do
217
226
oc adm groups prune --sync-config=sync-config.yaml --confirm
218
227
compare_and_cleanup valid_all_ldap_sync_prune.yaml
219
228
229
+ echo -e " \tTEST: Sync all LDAP groups from LDAP server using whitelist file, then prune OpenShift groups using the same whitelist file"
230
+ os::cmd::expect_success_and_text ' oc adm groups sync --whitelist=ldapgroupuids.txt --sync-config=sync-config-user-defined.yaml --confirm' ' group/'
231
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name}' ' firstgroup secondgroup thirdgroup'
232
+ os::cmd::expect_success_and_text ' oc adm groups prune --whitelist=ldapgroupuids.txt --sync-config=sync-config-user-defined.yaml --confirm | wc -l' ' 0'
233
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name}' ' firstgroup secondgroup thirdgroup'
234
+ os::cmd::expect_success_and_text ' oc patch group secondgroup -p "{\"metadata\":{\"annotations\":{\"openshift.io/ldap.uid\":\"cn=garbage\"}}}"' ' group "secondgroup" patched'
235
+ os::cmd::expect_success_and_text ' oc adm groups prune --whitelist=ldapgroupuids.txt --sync-config=sync-config-user-defined.yaml --confirm' ' group/secondgroup'
236
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name}' ' firstgroup thirdgroup'
237
+ os::cmd::expect_success_and_text ' oc delete groups --all' ' deleted'
238
+ os::cmd::expect_success_and_text ' oc get group -o jsonpath={.items[*].metadata.name} | wc -l' ' 0'
239
+
240
+
220
241
# PAGING
221
242
echo -e " \tTEST: Sync all LDAP groups from LDAP server using paged queries"
222
243
oc adm groups sync --sync-config=sync-config-paging.yaml --confirm
223
244
compare_and_cleanup valid_all_ldap_sync.yaml
224
245
246
+
247
+ os::test::junit::declare_suite_end
225
248
popd > /dev/null
226
249
done
227
250
0 commit comments