-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: mazerunner old error store test
adds a scenario to verify that errors stored in the old directory are reported by multiple clients
- Loading branch information
1 parent
45e8a35
commit 9afb2be
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...unner/src/main/java/com/bugsnag/android/mazerunner/scenarios/MultiClientOldDirScenario.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.Client | ||
import com.bugsnag.android.Configuration | ||
import com.bugsnag.android.disableAllDelivery | ||
import com.bugsnag.android.writeErrorToOldDir | ||
|
||
/** | ||
* Configures two Bugsnag clients with different API keys. A single error report is written to the | ||
* old directory format, which should then be reported by both clients. | ||
* | ||
*/ | ||
internal class MultiClientOldDirScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
var firstClient: Client? = null | ||
var secondClient: Client? = null | ||
|
||
fun configureClients() { | ||
firstClient = Client(context, config) | ||
|
||
Thread.sleep(10) // enforce request order | ||
val secondConfig = Configuration("abc123") | ||
secondConfig.endpoint = config.endpoint | ||
secondConfig.sessionEndpoint = config.sessionEndpoint | ||
secondClient = Client(context, secondConfig) | ||
} | ||
|
||
override fun run() { | ||
configureClients() | ||
|
||
if ("DeliverReport" != eventMetaData) { | ||
disableAllDelivery(firstClient!!) | ||
disableAllDelivery(secondClient!!) | ||
writeErrorToOldDir(firstClient!!) | ||
} | ||
} | ||
|
||
} |