Skip to content

Fix Flaky Integration Tests and CI Configuration Issues#1655

Merged
prachi-okta merged 8 commits intomasterfrom
fix-pagination-test
Nov 27, 2025
Merged

Fix Flaky Integration Tests and CI Configuration Issues#1655
prachi-okta merged 8 commits intomasterfrom
fix-pagination-test

Conversation

@prachi-okta
Copy link
Copy Markdown
Contributor

Issue(s)

Description

This PR resolves multiple flaky integration test failures caused by eventual consistency issues in the Okta API and improves CI pipeline stability by fixing resource constraints in the ReversingLabs security scanner.

Category

  • Bugfix
  • Enhancement
  • New Feature
  • Library Upgrade
  • Configuration Change
  • Versioning Change
  • Unit or Integration Test(s)
  • Documentation

Signoff

  • I have submitted a CLA for this PR
  • Each commit message explains what the commit does
  • I have updated documentation to explain what my PR does
  • My code is covered by tests if required
  • I did not edit any automatically generated files

The test was failing because the page counting logic only incremented
when collectedMembers.size() was divisible by the page limit (2).
With an odd number of total members (e.g., 3), this resulted in
pageCount staying at 1 instead of properly reflecting multiple pages.

Fixed by:
- Starting pageCount at 1 (since we always fetch at least one page)
- Tracking previousSize to detect when we cross page boundaries
- Incrementing pageCount when we've collected more items after
  hitting a page boundary (previousSize % 2 == 0)

This ensures the test correctly validates that pagination is working
across multiple API pages even when the total items is not evenly
divisible by the page limit.
- Collapsed nested if statements in MultiThreadingWarningUtil by combining
  conditions with && operator (lines 137-139 and 143-145)
- Removed unnecessary local variable 'url' in PagedIterator.parseNextLinkFromHeaders,
  returning the value directly (line 129)

These changes improve code readability and follow PMD best practices
without changing functionality.
- GroupsIT: Add 3s wait after group creation for search indexing
- UsersIT: Add 3s wait after user activation before listing
- PaginationIT: Increase wait to 5s for user indexing in filter tests
- IdpIT: Add comprehensive waits for IDP operations:
  * 3s after IDP creation
  * 2s after link/unlink operations
  * 2s before deletion
- All delays use Math.max(getTestOperationDelay(), minimumMs) pattern

Fixes flaky tests caused by eventual consistency in Okta API
- PaginationIT: Replace uniqueTestName with UUID for user emails to avoid conflicts
- IdpIT: Add eventual consistency delays to linkedInIdpTest (same pattern as other IDP tests)

This prevents 'user already exists' errors on test retries and fixes unlink timing issues
- IdpIT.facebookIdpTest: Increase link wait from 2s to 5s (Facebook IDP slower)
- UsersIT.createUserWithUserTypeTest: Add 2s delay after user creation
- UsersIT.filterUserTest: Increase delay to 3s for search indexing
- UsersIT.userSuspendTest: Add retry logic with exponential backoff for transient server errors (E0000009)

These changes improve test reliability against eventual consistency and transient API errors
- Add resource_class: xlarge to reversing-labs job (same as jdk11/jdk21)
- Increase no_output_timeout to 45m for scanner step
- Prevents SIGKILL (exit 9) when scanning 5,600+ files

Fixes: ReversingLabs scanner consistently failing with memory exhaustion
Copy link
Copy Markdown

@aniket-okta aniket-okta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@prachi-okta prachi-okta merged commit c74fb8e into master Nov 27, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants