-
Notifications
You must be signed in to change notification settings - Fork 53
[No Jira][v3] Adapt internal-testing-tools-package to v3 #1065
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
[No Jira][v3] Adapt internal-testing-tools-package to v3 #1065
Conversation
| DatadogSDKWrapper.shared.addOnSdkInitializedListener(listener: {core in | ||
| let proxiedCore = DatadogCoreProxy(core: core) | ||
| DatadogSDKWrapper.shared.setCoreInstance(core: proxiedCore) | ||
| CoreRegistry.unregisterDefault() |
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.
Calling register directly with the same name does not overwrite its value, so we need to call unregsiterDefault first to be able to set the proxied core as the default core.
|
|
||
| @objc | ||
| public func debug(message: String, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void { | ||
| if (!self.isSDKInitialized()) { |
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.
I removed these for two reasons:
- It's a bit weird that the logs module is checking for this when the native SDK does it too.
- When running the app with the internal testing tools module, this check will always be false, since the way in which the core SDK checks if the core is initialized is by checking the core type and comparing it with DatadogCore. Since the internal testing tools wrap it into a DatadogCoreProxy to allow for intercepting events this check always fails, even if the SDK is running fine.
And for those curious, this worked fine on v2 because the DatadogSdkWrapper kept a local reference to the core sdk instance, and the internal testing tools were wrapping that one instead, so calls to Datadog.isInitialized would still work fine as they would not deal with the wrapped core but with the internal SDK one.
What does this PR do?
The DatadogSDKWrapper has changed a bit on v3, mainly removing it's core SDK instance reference. On the other hand, the Write protocol was modified slightly for v3 of iOS, so the FEatureScopeInterceptor used to track events on internal tests needed to be adapted.
Motivation
We need the internal testing module working to be able to test v3 with out e2e test suite.
Additional data
I tested the fix locally with the nightly tests project and the test app builds and runs properly after this change.
Review checklist (to be filled by reviewers)