Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
[components] Revert "Use the local server for testing"
Browse files Browse the repository at this point in the history
This reverts commit 9f08e45.

In Glean v50 `testGetValue` methods are actually not gated on test
mode (it's still not recommended though and absolutely IS still a
test-only API for all intents and purposes).

Further it turns out that calling `GleanTestLocalServer` in one test
might influence the other test and we're seeing intermittens where
`BaselinePingTest` is trying to upload to `localhost:0`, which of course
is invalid.
I have not yet figured out how we can properly separate out the state.
Alternatively we could merge the 2 tests into a single one.

Fixes mozilla-mobile/android-components#11340
  • Loading branch information
badboy authored and mergify[bot] committed Aug 25, 2022
1 parent dd14cdf commit 6f50fbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ package mozilla.components.service.glean.testing
* initialize Glean more than once but still want to send pings to a local
* server for validation.
*
* FIXME(bug 1787234): State of the local server can persist across multiple test classes,
* leading to hard-to-diagnose intermittent test failures.
* It might be necessary to limit use of `GleanTestLocalServer` to a single test class for now.
*
* Example usage:
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

package org.mozilla.samples.glean

import android.content.Context
import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import mozilla.components.service.glean.testing.GleanTestLocalServer
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Rule
Expand All @@ -24,12 +21,6 @@ class MainActivityTest {
@get:Rule
val activityRule: ActivityScenarioRule<MainActivity> = ActivityScenarioRule(MainActivity::class.java)

@get:Rule
val gleanRule = GleanTestLocalServer(context, 0)

private val context: Context
get() = ApplicationProvider.getApplicationContext()

@Test
fun checkGleanClickData() {
// We don't reset the storage in this test as the GleanTestRule does not
Expand Down

0 comments on commit 6f50fbf

Please sign in to comment.