Commit bcf8673
authored
Fix/subscription it roles scope (#1696)
* fix(it): resilience fixes for eventual consistency, replication lag, and 401 scope failures
- SubscriptionIT: accept HTTP 401 in all four role-based sub-tests.
Okta evaluates OAuth2 scope (okta.roles.read / okta.roles.manage)
BEFORE path-parameter validation, so tokens without those scopes
receive 401 instead of the expected 404/400 from the invalid roleRef.
- GroupsIT.testListAllGroups: replace 1s sleep + unfiltered listGroups
(first page only) with a retry loop (20x1s) using q=groupName so the
newly created group is searched directly, avoiding indexing lag.
- RealmsIT.testListRealmsWithParameters: increase search-index retry
budget from 10x500ms (5s) to 20x1000ms (20s).
- PaginationIT.testPagedIterableWithFilter: replace fixed 5s sleep with
a retry loop (15x2s) that re-runs the listUsersPaged filter call until
the user appears in the search index.
- PaginationIT.testPagedIterableWithGroupMembers: add catch(ApiException)
for 404 around listGroupUsersPaged to surface replication-lag failures
with a clear message; add missing ApiException import.
- PoliciesIT.testListPolicyAppsWithMapParameter: replace 1s sleep with a
retry loop (5x3s) and catch(404) for app-policy association indexing lag.
- UserIT.testUserApiComprehensiveLifecycle: wrap getUser-by-login in a
retry loop (10x1s); login lookups go through the search index which
can lag unlike ID lookups.
- UserIT.testListUsersPagedWithContentType: wrap the paged for-loop in
try/catch(RuntimeException) to survive transient "Failed to fetch page"
errors during multi-page iteration with limit=1.
- UsersIT.listUsersTest / listUsersWithFilterTest: introduce
getUserWithRetry() helper (8x1.5s) for ID-based lookups that transiently
return 404 due to cross-cell replication lag.
- Added integration-tests/src/test/resources/okta.yaml.sample with a
fully-annotated template covering SSWS and OAuth2 modes, listing every
scope required for the ITs.
- Expanded integration-tests/README.md with a Required OAuth2 scopes
table; highlights okta.roles.read/manage as the scopes that make
Subscription role tests return precise 404/400 instead of 401.
* fix(it): resilience fixes for eventual consistency, replication lag, and 401 scope failures
- SubscriptionIT: accept HTTP 401 in all four role-based sub-tests.
Okta evaluates OAuth2 scope (okta.roles.read / okta.roles.manage)
BEFORE path-parameter validation, so tokens without those scopes
receive 401 instead of the expected 404/400 from the invalid roleRef.
- GroupsIT.testListAllGroups: replace 1s sleep + unfiltered listGroups
(first page only) with a retry loop (20x1s) using q=groupName so the
newly created group is searched directly, avoiding indexing lag.
- RealmsIT.testListRealmsWithParameters: increase search-index retry
budget from 10x500ms (5s) to 20x1000ms (20s).
- PaginationIT.testPagedIterableWithFilter: replace fixed 5s sleep with
a retry loop (15x2s) that re-runs the listUsersPaged filter call until
the user appears in the search index.
- PaginationIT.testPagedIterableWithGroupMembers: add catch(ApiException)
for 404 around listGroupUsersPaged to surface replication-lag failures
with a clear message; add missing ApiException import.
- PoliciesIT.testListPolicyAppsWithMapParameter: replace 1s sleep with a
retry loop (5x3s) and catch(404) for app-policy association indexing lag.
- UserIT.testUserApiComprehensiveLifecycle: wrap getUser-by-login in a
retry loop (10x1s); login lookups go through the search index which
can lag unlike ID lookups.
- UserIT.testListUsersPagedWithContentType: wrap the paged for-loop in
try/catch(RuntimeException) to survive transient "Failed to fetch page"
errors during multi-page iteration with limit=1.
- UsersIT.listUsersTest / listUsersWithFilterTest: introduce
getUserWithRetry() helper (8x1.5s) for ID-based lookups that transiently
return 404 due to cross-cell replication lag.
- Added integration-tests/src/test/resources/okta.yaml.sample with a
fully-annotated template covering SSWS and OAuth2 modes, listing every
scope required for the ITs.
- Expanded integration-tests/README.md with a Required OAuth2 scopes
table; highlights okta.roles.read/manage as the scopes that make
Subscription role tests return precise 404/400 instead of 401.
* fix(it): resilience fixes for replication lag and transient paging errors
- PaginationIT.testPagedIterableWithUsers / testPagedIterableEarlyBreak:
wrap the paged for-loop in try/catch(RuntimeException) so a transient
"Failed to fetch page" (rate-limit/5xx/auth-refresh wrapped by the paged
iterator) no longer fails the test; early-break skips assertions if no
user was fetched before the hiccup.
- GroupsIT.testListGroupMembers: catch 404 (UserGroup) inside the member
retry loop so a not-yet-visible group on the read replica is retried
instead of failing; bump retries 10 -> 20.
- OrgSettingGeneralIT.testOrgGeneralSettingsLifecycle: poll getOrgSettings()
(20x1s) until the PUT full-replace is visible before asserting, to handle
read-after-write replication lag returning the stale pre-replace value.1 parent 2082fa6 commit bcf8673
9 files changed
Lines changed: 200 additions & 59 deletions
File tree
- integration-tests
- src/test/groovy/com/okta/sdk/tests/it
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
8 | 36 | | |
9 | 37 | | |
10 | 38 | | |
| |||
Lines changed: 29 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
268 | 277 | | |
269 | 278 | | |
270 | | - | |
271 | | - | |
| 279 | + | |
272 | 280 | | |
273 | 281 | | |
274 | 282 | | |
| |||
647 | 655 | | |
648 | 656 | | |
649 | 657 | | |
650 | | - | |
| 658 | + | |
651 | 659 | | |
652 | 660 | | |
653 | 661 | | |
654 | 662 | | |
655 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
656 | 676 | | |
657 | 677 | | |
658 | 678 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
163 | 166 | | |
164 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
165 | 173 | | |
166 | | - | |
| 174 | + | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
| |||
Lines changed: 51 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
| |||
254 | 263 | | |
255 | 264 | | |
256 | 265 | | |
257 | | - | |
258 | | - | |
| 266 | + | |
| 267 | + | |
259 | 268 | | |
260 | 269 | | |
261 | 270 | | |
| |||
269 | 278 | | |
270 | 279 | | |
271 | 280 | | |
272 | | - | |
273 | | - | |
| 281 | + | |
| 282 | + | |
274 | 283 | | |
275 | 284 | | |
276 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
277 | 294 | | |
278 | 295 | | |
279 | 296 | | |
| |||
333 | 350 | | |
334 | 351 | | |
335 | 352 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
341 | 370 | | |
342 | 371 | | |
343 | | - | |
| 372 | + | |
344 | 373 | | |
345 | | - | |
346 | | - | |
| 374 | + | |
| 375 | + | |
347 | 376 | | |
348 | 377 | | |
349 | 378 | | |
| |||
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
958 | 958 | | |
959 | 959 | | |
960 | 960 | | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
966 | 976 | | |
967 | 977 | | |
968 | 978 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| 112 | + | |
109 | 113 | | |
110 | | - | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
| |||
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| 125 | + | |
121 | 126 | | |
122 | | - | |
| 127 | + | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
| |||
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
| 138 | + | |
133 | 139 | | |
134 | | - | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| |||
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
195 | 206 | | |
196 | 207 | | |
197 | 208 | | |
| |||
848 | 859 | | |
849 | 860 | | |
850 | 861 | | |
851 | | - | |
852 | | - | |
853 | | - | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
854 | 872 | | |
855 | 873 | | |
856 | 874 | | |
| |||
0 commit comments