Skip to content
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

Fix FIAM test flakes and exposed library bugs #3101

Merged
merged 7 commits into from Jun 3, 2019
Merged

Fix FIAM test flakes and exposed library bugs #3101

merged 7 commits into from Jun 3, 2019

Conversation

@paulb777
Copy link
Member

@paulb777 paulb777 commented May 28, 2019

Fix #3046.

  • Add a test specific cache file for logStorage so that tests don't fail because of stuff in the cache from other tests. Thanks to @ryanwilson for the suggestion and helper file implementation!
  • Set up the self.mockTimeFetcher currentTimestampInSeconds stub before the mock is passed to other functions.
  • Stop calling scheduleNextSend in the initializer since the first zero-delayed log can happen logs to happen to soon.
  • Remove early exit from scheduleNextSend since it can cause logs to get dropped if the first zero-length log is scheduled, the next real log gets scheduled, but the log has already been dropped because of no packets available.
  • Multiple spelling and wording fixes.
@paulb777 paulb777 requested review from christibbs and ryanwilson May 28, 2019
@paulb777 paulb777 changed the title Fix FIAM test flakes and resulting library bugs Fix FIAM test flakes and exposed library bugs May 28, 2019
@paulb777
Copy link
Member Author

@paulb777 paulb777 commented May 29, 2019

Tests ran cleanly except for #3102

@@ -105,9 +105,6 @@ - (instancetype)initWithRequestSender:(FIRIAMClearcutHttpRequestSender *)request
_nextValidSendTimeInMills = (int64_t)
[_userDefaults doubleForKey:FIRIAM_UserDefaultsKeyForNextValidClearcutUploadTimeInMills];

// seed the first send upon SDK start-up
[self scheduleNextSend];
Copy link
Member

@ryanwilson ryanwilson May 29, 2019

Will want to hear back from @christibbs about this one. We may want to do this in case there are actually pending logs that are written to disk?

Copy link
Contributor

@christibbs christibbs May 30, 2019

Trying out an approach where we only call this if there are pending logs to be sent.

@@ -205,15 +202,6 @@ - (void)attemptUploading {
}

- (void)scheduleNextSend {
@synchronized(self) {
if (_nextSendScheduled) {
Copy link
Member

@ryanwilson ryanwilson May 29, 2019

Don't we want to keep this, checking if _nextSendScheduled is already set? I noticed in the log you mentioned it could cause an issue, but is the issue because of this check AND the scheduleNextSend in the init or just the one?

Copy link
Contributor

@christibbs christibbs May 30, 2019

I added this check back, but I'm not sure what _nextSendScheduled = YES in the else block was doing.. it's already being set to YES at the end of the method. I removed the else block.

Copy link
Member Author

@paulb777 paulb777 May 30, 2019

I think this could still cause problems if you want to change waitTime. The new waitTime will get ignored for the next scheduled send. Perhaps that's ok?

Copy link
Contributor

@christibbs christibbs May 30, 2019

I think that should be fine. The timing of sending logs doesn't need to be precise in this case.

InAppMessaging/Example/Tests/FIRIAMClearcutUploaderTests.m Outdated Show resolved Hide resolved
…File. Move mock setup of mockTimeFetcher prior to initializing FIRIAMClearcutLogStorage
@ryanwilson
Copy link
Member

@ryanwilson ryanwilson commented May 30, 2019

LGTM but want to confirm that the scheduleNextSend logic change is okay and is tested with a sample app.

@christibbs
Copy link
Contributor

@christibbs christibbs commented May 30, 2019

@ryanwilson I'm testing out an approach where it only schedules the next send on init if there are logs to be sent at that time.

@christibbs christibbs merged commit dd00263 into master Jun 3, 2019
2 checks passed
@paulb777 paulb777 deleted the pb-fiam-flakes branch Jun 29, 2019
@firebase firebase locked and limited conversation to collaborators Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants