-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply latest AEPTestUtil updates (5.1.0) #1057
Apply latest AEPTestUtil updates (5.1.0) #1057
Conversation
…afe version Create extension to ThreadSafeDictionary for additional features Remove use of queue at the method level for multi thread protection Use Swifty syntax for dictionary defaults
…access Instead of putting entire assertion logic into queue task, only put the dictionary read operation in the task and use the local copy in the rest of the logic. This way, the semaphore is not blocking network requests and responses from being recorded
return nil | ||
let testableNetworkRequest = TestableNetworkRequest(from: networkRequest) | ||
return queue.sync { | ||
return self.expectedNetworkRequests[testableNetworkRequest]?.await(timeout: timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the queue to only query expectedNetworkRequests
and move the await
outside ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Updated
|
||
func retryInterval(for entity: DataEntity) -> TimeInterval { | ||
return 1 | ||
} | ||
|
||
func processHit(entity: DataEntity, completion: @escaping (Bool) -> Void) { | ||
processedHits.append(entity) | ||
completion(hitResult) | ||
queue.sync { | ||
completion(_hitResult) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the dispatch queue when accessing _hitReques and call the completion handler outside the queue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Updated to get the value (relying on _hitResult
's queue get implementation) but call the completion handler outside the queue
… queue but move completion call outside of queue
queue.sync { | ||
completion(_hitResult) | ||
} | ||
var hitResult = _hitResult |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this line so that completion(hitResult)
directly reads the boolean using the property defined in the class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
* Initial setup for AEPTestUtils as local module within Core * Update AEPTestUtils podspec configuration 1. Version to 5.0.2 2. Homepage to point to Core repo URL 3. License format to match all other podspecs in Core 4. Source to point to Core repo URL 5. Source files point to PublicTestUtils under Core and Services 6. Core and Services dependency restricted to 5.2.0 < 6 * Create contribution guide for AEPTestUtils * Add more info for how to add test helper files in AEPTestUtils contribution guide * Create AEPTestUtils specific version update script and workflow action * Workflow debug steps * Add more debug steps to workflow * Update shell * Fix version taken from workflow input * Update sed command usage * Version script updates * Script updates * fix workflow script * Update workflow * Rename AEPTestUtil version script and workflow file names for clarity Remove debug prints from both files * Update dependencies update logic * Revert "Update dependencies update logic" This reverts commit 6fc046f. * Use per dependency check instead * Create Package.swift for AEPTestUtils * Revert "Create Package.swift for AEPTestUtils" This reverts commit 52a0561. * Revert copyright year to original * Add back existing files * Try to trigger cache miss * Fix incorrect project target AEPCoreMocks Compile Sources file paths for some files * Revert "Try to trigger cache miss" This reverts commit a8f6801. * Update TestUtils contributing guide documentation for clarity * Consolidate version update script, adding logic to handle TestUtils specific flow * Update TestUtils version workflow to use updated version script * Bump AEPTestUtils podspec version * Create podspec verification script for AEPTestUtils * Create test workflow to run AEPTestUtils podspec check script * Remove the dependency on internal AEPServicesMocks in public AEPTestUtils files * Update AEPCore and AEPServices podspecs to allow for ENABLE_TESTING_SEARCH_PATHS * Fix testable flag in AEPCore and AEPServices podspecs * Try adding ENABLE_TESTING_SEARCH_PATHS flag to AEPTestUtils * Try adding ENABLED_TESTABILITY flag to AEPTestUtils podspec * Fix typo in podspec 'ENABLE_TESTABILITY' flag * Update podspecs to use test target * Try different flags for AEPTestUtils * Try different flags for AEPTestUtils * Tweak AEPTestUtils flags * Update validation script to use test target instead of regular * Check removing custom flags * Remove custom flag stuff from podspecs * Create release workflow for AEPTestUtils with validation as a prereq * release_testutils.yml - Fix script path and temp disable main branch check * release_testutils.yml - add step to install xcodegen * release_testutils.yml - update runner to macos and add version format validation * Update podspec_version logic * temp disable podspec validation * Add git author information * Testing removing git author and reenabling main branch if * Hardcode `main` branch for release_testutils workflow Reenable all steps * Remove temp workflow * Add makefile rule for testutils podspec validation and update workflow usage * Temp disable main branch checkout * Reenable main branch checkout * Revert "Remove the dependency on internal AEPServicesMocks in public AEPTestUtils files" This reverts commit 58c3687. * Revert "Remove temp workflow" This reverts commit ef41e52. * Remove test workflow again * update-versions.sh - Remove multiplatform sed compatibility in favor of original macOS version Update testutils version workflow to use macOS runner * Apply latest AEPTestUtil updates (5.1.0) (#1057) * Bring over latest AEPTestUtils changes (since 5.1.0) * Make utilities Threadsafe * Update AEPTestUtils version to 5.2.0 * Improve AEPTestUtils Network Service helper class multi thread handling and method docs (#1058) * NetworkRequestHelper.swift - Reorder methods by functionality, update method docs, add deprecation to flatten map method * RealNetworkService.swift - Update method docs and method ordering * MockNetworkService.swift - Update method docs and method ordering * NetworkRequestHelper.swift - Update method to perform await outside of sync block * NetworkRequestHelper.swift - Update to use Log and add error log for invalid URL string * Update JSON comparison APIs (#1059) * Remove deprecated APIs and add support for new path options * Add support for new path options ElementCount and ValueNotEqual Remove deprecated logic and path interpretation logic Reorder methods based on usage and dependency * Enhance test failure messages and update variable name from wildcard to accurate any order Update failure message strings to use regular multiline strings to reduce unused syntax * XCTestCase+AnyCodableAsserts.swift - Update code docs * Apply lint * Update access level to private * Create JSON comparison API migration docs (#1062) * Create JSON comparison API migration docs * Simplify path options usage example Reorder migration patterns sections Add additional example using type match as default for mixed exact vs type match validation section * Fix flaky Identity tests (#1061) --------- Co-authored-by: Praveen <praveek@users.noreply.github.com>
Description
This PR brings over the latest updates from AEPTestUtils (up to 5.1.0) and also updates
NetworkRequestHelper
class to useThreadSafeDictionary
andThreadSafeArray
instead of a queue at the class level.ThreadSafe
changes have been tested with Edge extension functional and integration tests locallyThere is a breaking change where the parameter name
expectationTimeout
has been renamed totimeout
acrossNetworkRequestHelper
,MockNetworkService
, andRealNetworkService
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: