-
Notifications
You must be signed in to change notification settings - Fork 626
Crashlytics smoke test stubs #2737
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
Conversation
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (83fe61c0) is created by Prow via merging commits: 1b0fdcf 2f1569a. |
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (83fe61c0) is created by Prow via merging commits: 1b0fdcf 2f1569a. |
Macrobenchmark ReportAffected SDKsMeasurements are for head commit (a53c473). Diffing against base commit (c7d8a80) is working in progress.
|
5727629
to
acfe867
Compare
1431376
to
03afcd7
Compare
One test validates the Analytics integration; the rest are simple stubbs for now.
03afcd7
to
5ab83f5
Compare
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.
Thanks for adding this test! LGTM.
Object core = coreField.get(crashlytics); | ||
Field breadcrumbSourceField = core.getClass().getDeclaredField("breadcrumbSource"); | ||
breadcrumbSourceField.setAccessible(true); | ||
BreadcrumbSource breadcrumbSource = (BreadcrumbSource)breadcrumbSourceField.get(core); |
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.
BreadcrumbSource breadcrumbSource = (BreadcrumbSource)breadcrumbSourceField.get(core); | |
BreadcrumbSource breadcrumbSource = (BreadcrumbSource) breadcrumbSourceField.get(core); |
/retest |
@vkryachko Adding you as a reviewer about the reflections and additional proguard rules. |
try { | ||
// need to use reflection to get the breadcrumb handler. | ||
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); | ||
Field coreField = crashlytics.getClass().getDeclaredField("core"); |
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 feel like this use of reflection could cause maintenance problems down the road.
There seems to be an easy workaround, given the following observation: core
is not a private field and is visible within the com.google.firebase.crashlytics
package. @mrichards Can we move this test into src/main/java/com/google/firebase/crashlytics
and access the field directly?
As for breadcrumbSource, can we make it public and annotation with @VisibleForTesting
? (could actually be used with core
above as well)
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.
@vkryachko Please take a look at the updated implementation. I moved CrashlyticsTest
to the crashlytics package, because making core
public in FirebaseCrashlytics makes it visible in the IDE's autocomplete for customers, even when @VisibleForTesting
was used.
LMK if this is consistent with your suggestion.
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.
LGTM with minor nits
@@ -156,7 +157,8 @@ public Void call() throws Exception { | |||
return new FirebaseCrashlytics(core); | |||
} | |||
|
|||
private final CrashlyticsCore core; | |||
// package-private for smoke tests | |||
final CrashlyticsCore core; |
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.
Could you still add @VisibleForTesting
?
private final IdManager idManager; | ||
private final BreadcrumbSource breadcrumbSource; | ||
|
||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) |
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 think otherwise = Private is the default, so no need to explicitly specify
@mrichards: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
No description provided.