Skip to content
Permalink
Newer
Older
100644 303 lines (242 sloc) 12.7 KB
1
#!/usr/bin/env bats
2
3
load ../../../common
4
load ../../../library
5
6
@test "000 Cleanup before running the tests" {
7
(cd ../simple ; docker-compose down -v)
8
(cd ../shibboleth ; docker-compose down -v)
9
(cd ../postgresql ; docker-compose down -v)
10
docker-compose down -v
11
}
12
13
@test "010 Initialize and start the composition" {
14
# We want to fail cleanly if there's any interference
15
docker ps
16
! (docker ps | grep -E "shibboleth_(idp|directory)_1|(grouper|simple|shibboleth|postgresql)_(midpoint_server|midpoint_data)_1")
17
docker-compose build --pull grouper_daemon grouper_ui grouper_data directory sources midpoint_data idp mq
18
# Sometimes the tier/midpoint:xyz is not yet in the repository, causing issues with --pull
19
docker-compose build midpoint_server
20
docker-compose up -d
21
}
22
23
@test "020 Wait until components are started" {
24
touch $BATS_TMPDIR/not-started
25
wait_for_midpoint_start grouper_midpoint_server_1 grouper_midpoint_data_1
26
wait_for_shibboleth_idp_start grouper_idp_1
27
wait_for_grouper_ui_start grouper_grouper_ui_1
28
rm $BATS_TMPDIR/not-started
29
}
30
31
@test "040 Check midPoint health" {
32
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
33
check_health
34
}
35
36
@test "050 Check Shibboleth IDP health" {
37
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
38
check_health_shibboleth_idp
39
}
40
41
#@test "060 Check Grouper health" {
42
# if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
43
# skip TODO
44
#}
45
46
@test "100 Get 'administrator'" {
47
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
48
check_health
49
get_and_check_object users 00000000-0000-0000-0000-000000000002 administrator
50
}
51
52
@test "110 And and get 'test110'" {
53
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
54
check_health
55
echo "<user><name>test110</name></user>" >/tmp/test110.xml
56
add_object users /tmp/test110.xml
57
rm /tmp/test110.xml
58
search_and_check_object users test110
59
delete_object_by_name users test110
60
}
61
62
@test "200 Upload objects" {
63
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
64
65
# reduce data in SIS database so imports will take reasonable time
66
docker exec grouper_sources_1 mysql sis -u root -p123321 -e "delete from SIS_COURSES where uid not in ('amorrison', 'banderson', 'cmorrison', 'danderson', 'ddavis', 'jsmith', 'kwhite', 'mroberts', 'whenderson', 'wprice')"
67
docker exec grouper_sources_1 mysql sis -u root -p123321 -e "delete from SIS_AFFILIATIONS where uid not in ('amorrison', 'banderson', 'cmorrison', 'danderson', 'ddavis', 'jsmith', 'kwhite', 'mroberts', 'whenderson', 'wprice')"
68
docker exec grouper_sources_1 mysql sis -u root -p123321 -e "delete from SIS_PERSONS where uid not in ('amorrison', 'banderson', 'cmorrison', 'danderson', 'ddavis', 'jsmith', 'kwhite', 'mroberts', 'whenderson', 'wprice')"
69
70
check_health
71
./upload-objects.sh
72
73
search_and_check_object objectTemplates template-user
74
75
search_and_check_object archetypes affiliation
76
search_and_check_object archetypes course
77
search_and_check_object archetypes department
79
search_and_check_object orgs affiliations
80
search_and_check_object orgs courses
81
search_and_check_object orgs departments
82
83
search_and_check_object resources "LDAP (directory)"
84
search_and_check_object resources "Grouper Resource"
85
search_and_check_object resources "SQL SIS persons (sources)"
86
87
search_and_check_object roles metarole-grouper-provided-group
88
search_and_check_object roles metarole-ldap-group
89
search_and_check_object roles role-ldap-basic
90
}
91
92
@test "210 Test resources" {
93
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
94
test_resource 0a37121f-d515-4a23-9b6d-554c5ef61272
95
test_resource 4d70a0da-02dd-41cf-b0a1-00e75d3eaa15
96
test_resource a343fc2e-3954-4034-ba1a-2b72c21e577a
97
test_resource e417225d-8a08-46f3-9b5d-624990b52386
98
test_resource fe805d13-481b-43ec-97d8-9d2df72cd38e
99
test_resource 1eff65de-5bb6-483d-9edf-8cc2c2ee0233
100
}
101
102
@test "215 Recompute banderson and sysadmingroup" {
103
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
104
105
./recompute.sh
106
}
107
108
@test "220 Import SIS_PERSONS" {
109
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
110
111
add_object tasks midpoint-objects-manual/tasks/task-import-sis-persons.xml
112
search_and_check_object tasks "Import from SIS persons"
113
wait_for_task_completion 22c2a3d0-0961-4255-9eec-c550a79aeaaa 6 10
114
assert_task_success 22c2a3d0-0961-4255-9eec-c550a79aeaaa
115
116
search_and_check_object users jsmith
117
search_and_check_object users banderson
118
search_and_check_object users kwhite
119
search_and_check_object users whenderson
120
search_and_check_object users ddavis
121
search_and_check_object users cmorrison
122
search_and_check_object users danderson
123
search_and_check_object users amorrison
124
search_and_check_object users wprice
125
search_and_check_object users mroberts
126
127
check_ldap_account_by_user_name jsmith grouper_directory_1
128
check_ldap_account_by_user_name banderson grouper_directory_1
129
check_ldap_account_by_user_name kwhite grouper_directory_1
130
check_ldap_account_by_user_name whenderson grouper_directory_1
131
check_ldap_account_by_user_name ddavis grouper_directory_1
132
check_ldap_account_by_user_name cmorrison grouper_directory_1
133
check_ldap_account_by_user_name danderson grouper_directory_1
134
check_ldap_account_by_user_name amorrison grouper_directory_1
135
check_ldap_account_by_user_name wprice grouper_directory_1
136
check_ldap_account_by_user_name mroberts grouper_directory_1
137
}
138
139
@test "230 Create ref loaders" {
140
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
141
142
./create-ref-loaders.sh
143
}
144
145
@test "235 Wait for loaders to run" {
146
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
147
148
sleep 120
149
}
150
151
@test "240 Create additional ref groups" {
152
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
153
154
./add-ref-groups.sh
155
}
156
157
#@test "250 Check 'TestUser250' in midPoint and LDAP" {
158
# if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
159
#
160
# check_health
161
# echo "<user><name>TestUser250</name><fullName>Test User250</fullName><givenName>Test</givenName><familyName>User250</familyName><credentials><password><value><clearValue>password</clearValue></value></password></credentials></user>" >/tmp/testuser250.xml
162
# add_object users /tmp/testuser250.xml
163
# rm /tmp/testuser250.xml
164
# search_and_check_object users TestUser250
165
#
166
# # probably will not work
167
# execute_bulk_action tests/resources/bulk-action/assign-role-grouper-sysadmin-to-test-user.xml grouper_midpoint_server_1
168
#
169
# check_ldap_account_by_user_name TestUser250 grouper_directory_1
170
# check_of_ldap_membership TestUser250 "ou=groups,dc=internet2,dc=edu" "sysadmingroup" grouper_directory_1
171
#
172
# delete_object_by_name users TestUser250
173
#}
174
175
@test "310 Import Grouper-to-midPoint async update task" {
176
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
177
178
check_health
179
add_object tasks midpoint-objects-manual/tasks/task-async-update-grouper.xml
180
search_and_check_object tasks "Grouper async updates"
181
}
182
183
@test "320 Wait for the queue to become empty" {
184
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
185
186
ATTEMPT=0
187
MAX_ATTEMPTS=20
188
DELAY=10
189
190
get_messages sampleQueue
191
echo "Messages: $MESSAGES"
192
193
until [[ $ATTEMPT = $MAX_ATTEMPTS ]]; do
194
ATTEMPT=$((ATTEMPT+1))
195
get_messages sampleQueue
196
echo "Messages: $MESSAGES"
197
if [ "$MESSAGES" = "0" ]; then return 0; fi
198
echo "Waiting $DELAY seconds for the queue to become empty (attempt $ATTEMPT) ..."
199
sleep $DELAY
200
done
201
return 1
202
}
203
204
@test "330 Check groups in midPoint and LDAP" {
205
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
206
207
search_and_check_object orgs course_ACCT101
208
search_and_check_object orgs course_ACCT201
209
search_and_check_object orgs course_CS251
210
search_and_check_object orgs course_CS252
211
search_and_check_object orgs course_MATH100
212
search_and_check_object orgs course_MATH101
213
search_and_check_object orgs course_SCI123
214
search_and_check_object orgs course_SCI404
215
216
check_ldap_courses_by_name course_ACCT101 grouper_directory_1
217
check_ldap_courses_by_name course_ACCT201 grouper_directory_1
218
check_ldap_courses_by_name course_CS251 grouper_directory_1
219
check_ldap_courses_by_name course_CS252 grouper_directory_1
220
check_ldap_courses_by_name course_MATH100 grouper_directory_1
221
check_ldap_courses_by_name course_MATH101 grouper_directory_1
222
check_ldap_courses_by_name course_SCI123 grouper_directory_1
223
check_ldap_courses_by_name course_SCI404 grouper_directory_1
224
}
225
226
@test "340 Execute triggers and check group membership in LDAP" {
227
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
228
229
sleep 60
230
run_task_now "00000000-0000-0000-0000-000000000007" grouper_midpoint_server_1
231
sleep 30
232
233
# memberships will be there only after triggers are executed
234
235
check_of_ldap_membership amorrison "ou=courses,ou=groups,dc=internet2,dc=edu" "ACCT101" grouper_directory_1
236
check_of_ldap_membership cmorrison "ou=courses,ou=groups,dc=internet2,dc=edu" "ACCT101" grouper_directory_1
237
check_of_ldap_membership mroberts "ou=courses,ou=groups,dc=internet2,dc=edu" "ACCT101" grouper_directory_1
238
check_of_ldap_membership whenderson "ou=courses,ou=groups,dc=internet2,dc=edu" "ACCT101" grouper_directory_1
240
check_of_ldap_membership amorrison "ou=courses,ou=groups,dc=internet2,dc=edu" "CS251" grouper_directory_1
241
check_of_ldap_membership cmorrison "ou=courses,ou=groups,dc=internet2,dc=edu" "CS251" grouper_directory_1
242
check_of_ldap_membership ddavis "ou=courses,ou=groups,dc=internet2,dc=edu" "CS251" grouper_directory_1
243
check_of_ldap_membership mroberts "ou=courses,ou=groups,dc=internet2,dc=edu" "CS251" grouper_directory_1
245
check_of_ldap_membership kwhite "ou=courses,ou=groups,dc=internet2,dc=edu" "CS252" grouper_directory_1
246
247
check_of_ldap_membership danderson "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH100" grouper_directory_1
248
check_of_ldap_membership ddavis "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH100" grouper_directory_1
249
check_of_ldap_membership kwhite "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH100" grouper_directory_1
250
check_of_ldap_membership wprice "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH100" grouper_directory_1
252
check_of_ldap_membership amorrison "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH101" grouper_directory_1
253
check_of_ldap_membership cmorrison "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH101" grouper_directory_1
254
check_of_ldap_membership mroberts "ou=courses,ou=groups,dc=internet2,dc=edu" "MATH101" grouper_directory_1
256
check_of_ldap_membership danderson "ou=courses,ou=groups,dc=internet2,dc=edu" "SCI123" grouper_directory_1
257
check_of_ldap_membership mroberts "ou=courses,ou=groups,dc=internet2,dc=edu" "SCI123" grouper_directory_1
258
259
check_of_ldap_membership kwhite "ou=courses,ou=groups,dc=internet2,dc=edu" "SCI404" grouper_directory_1
260
check_of_ldap_membership wprice "ou=courses,ou=groups,dc=internet2,dc=edu" "SCI404" grouper_directory_1
261
}
262
263
@test "400 Suspend async update task" {
264
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
265
266
suspend_task 47fc57bd-8c34-4555-9b9f-7087ff179860 grouper_midpoint_server_1
267
wait_for_task_completion 47fc57bd-8c34-4555-9b9f-7087ff179860 5 10
268
}
269
270
@test "410 Add wprice to 'ref:affiliation:alum_includes' groups" {
271
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
272
273
docker cp tests/resources/grouper/t410.gsh grouper_grouper_daemon_1:/tmp/
274
docker exec grouper_grouper_daemon_1 bash -c "/opt/grouper/grouper.apiBinary/bin/gsh /tmp/t410.gsh"
275
}
276
277
@test "420 Reconcile Grouper" {
278
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
279
280
add_object tasks midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml
281
search_and_check_object tasks "Grouper reconciliation (groups)"
282
wait_for_task_completion 605a0127-a313-442a-9d5e-151eac8b0745 6 10
283
assert_task_success 605a0127-a313-442a-9d5e-151eac8b0745
285
286
@test "430 Recompute users" {
287
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
288
289
add_object tasks midpoint-objects-manual/tasks/task-recomputation-users.xml
290
search_and_check_object tasks "User recomputation"
291
wait_for_task_completion 83a737ea-5eb7-4e78-b431-331cccf02354 6 10
292
assert_task_success 83a737ea-5eb7-4e78-b431-331cccf02354
293
}
294
295
@test "440 Check wprice group membership in LDAP" {
296
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
297
298
check_of_ldap_membership wprice "ou=Affiliations,ou=Groups,dc=internet2,dc=edu" "alum" grouper_directory_1
299
}
301
@test "999 Clean up" {
302
docker-compose down -v
303
}
You can’t perform that action at this time.