Commit 4f0bff27 authored by travis79's avatar travis79
Browse files

Remove GCP ping redirection for tagged pings

- This removes the redirection to GCP endpoint for all tagged pings.
- Fix tests depending on redirection of tagged pings.
parent 1bf1436b
......@@ -65,7 +65,6 @@ data class Configuration internal constructor(
companion object {
const val DEFAULT_TELEMETRY_ENDPOINT = "https://incoming.telemetry.mozilla.org"
const val DEFAULT_DEBUGVIEW_ENDPOINT = "https://stage.ingestion.nonprod.dataops.mozgcp.net"
const val DEFAULT_USER_AGENT = "Glean/${BuildConfig.LIBRARY_VERSION} (Android)"
const val DEFAULT_CONNECTION_TIMEOUT = 10000L
const val DEFAULT_READ_TIMEOUT = 30000L
......
......@@ -92,11 +92,6 @@ internal class HttpPingUploader : PingUploader {
// for "debug view" use.
config.pingTag?.let {
headers.append("X-Debug-ID", it)
// NOTE: Tagged pings must be redirected to the GCP endpoint as the AWS endpoint isn't
// configured to handle them. This may pose an issue with testing if a local server
// is used to capture pings.
endpoint = Configuration.DEFAULT_DEBUGVIEW_ENDPOINT
}
return Request(
......
......@@ -230,7 +230,7 @@ internal fun triggerWorkManager() {
* This is a helper class to facilitate testing of ping tagging
*/
internal class TestPingTagClient(
private val responseUrl: String = Configuration.DEFAULT_DEBUGVIEW_ENDPOINT,
private val responseUrl: String = Configuration.DEFAULT_TELEMETRY_ENDPOINT,
private val responseStatus: Int = 200,
private val responseHeaders: Headers = MutableHeaders(),
private val responseBody: Response.Body = Response.Body.empty(),
......
......@@ -204,10 +204,9 @@ class GleanDebugActivityTest {
fun `pings are correctly tagged using tagPings`() {
val pingTag = "test-debug-ID"
// The TestClient class found at the bottom of this file is used to intercept the request
// in order to check that the header has been added and the URL has been redirected.
// The TestClient class found in TestUtil is used to intercept the request in order to check
// that the header has been added correctly for the tagged ping.
val testClient = TestPingTagClient(
responseUrl = Configuration.DEFAULT_DEBUGVIEW_ENDPOINT,
debugHeaderValue = pingTag)
// Use the test client in the Glean configuration
......
......@@ -10,7 +10,6 @@ import mozilla.components.concept.fetch.Response
import mozilla.components.lib.fetch.httpurlconnection.HttpURLConnectionClient
import mozilla.components.lib.fetch.okhttp.OkHttpClient
import mozilla.components.service.glean.BuildConfig
import mozilla.components.service.glean.TestPingTagClient
import mozilla.components.service.glean.config.Configuration
import mozilla.components.service.glean.getMockWebServer
import mozilla.components.support.test.any
......@@ -287,26 +286,4 @@ class HttpPingUploaderTest {
val request = uploader.buildRequest(testPath, testPing, debugConfig)
assertEquals("this-ping-is-tagged", request.headers!!["X-Debug-ID"])
}
@Test
fun `server is correctly redirected when pings are tagged`() {
val pingTag = "this-ping-is-tagged"
// The TestClient class found at the bottom of this file is used to intercept the request
// in order to check that the header has been added and the URL has been redirected.
val testClient = TestPingTagClient(
responseUrl = Configuration.DEFAULT_DEBUGVIEW_ENDPOINT,
debugHeaderValue = pingTag)
// Use the test client in the Glean configuration
val testConfig = testDefaultConfig.copy(
httpClient = lazy { testClient },
pingTag = pingTag
)
// This should trigger the call to `fetch()` within the TestPingTagClient which will perform
// both a check against the url and that a header was added.
val client = HttpPingUploader()
assertTrue(client.upload(testPath, testPing, testConfig))
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment