Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract class BaseRumViewTest {
variant = "debug",
service = "test-service"
)
.useSite(DatadogSite.LOCAL)
.useSite(DatadogSite.STAGING)
.setBatchSize(BatchSize.SMALL)
.setUploadFrequency(UploadFrequency.FREQUENT)
.build()
Expand Down Expand Up @@ -100,7 +100,7 @@ abstract class BaseRumViewTest {
.apply {
_RumInternalProxy.setRumViewEventWriteConfig(
builder = this@apply,
config = RumViewEventWriteConfig.AlwaysFullView
config = RumViewEventWriteConfig.FullViewOnlyAtStart
)
}
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal data class RumSearchResponse(

@Serializable
data class RumEventAttributes(
@SerialName("service") val service: String? = null,
@SerialName("service") val service: kotlinx.serialization.json.JsonElement? = null,
@SerialName("attributes") val attributes: RumAttributes,
@SerialName("timestamp") val timestamp: String,
@SerialName("tags") val tags: List<String> = emptyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ internal class RumSearchResponseViewEventAssert(actual: RumSearchResponse.ViewEv
}

fun hasService(service: String): RumSearchResponseViewEventAssert {
assertThat(actual.attributes.service)
.overridingErrorMessage("Expected service to be <%s> but was <%s>", service, actual.attributes.service)
assertThat(actual.attributes.attributes.service)
.overridingErrorMessage("Expected service to be <%s> but was <%s>", service, actual.attributes.attributes.service)
.isEqualTo(service)
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ class RumViewUpdateTest : BaseRumViewTest() {
contextAttributes = mapOf("test_view_index" to 14)
)
},
predicate = { it.optionalResult?.data?.firstOrNull() != null },
predicate = {
val found = it.optionalResult?.data?.firstOrNull() != null
android.util.Log.w("POLL_DEBUG", "predicate: found=$found")
found
},
interval = POLLING_INTERVAL_MS.milliseconds,
timeout = POLLING_TIMEOUT_MS.milliseconds
)
Expand Down Expand Up @@ -201,7 +205,7 @@ class RumViewUpdateTest : BaseRumViewTest() {

companion object {
private const val VIEW_NAME = "rum-view-update-test"
private const val POLLING_TIMEOUT_MS = 30_000L
private const val POLLING_TIMEOUT_MS = 60_000L
private const val POLLING_INTERVAL_MS = 5_000L
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,25 @@ internal suspend inline fun <reified T : Any> HttpClient.safePost(url: Url, body
}
val statusCode = response.status
when (statusCode.value) {
in 500..599 -> KtorHttpResponse.ServerError(statusCode)
in 400..499 -> KtorHttpResponse.ClientError(statusCode)
else -> KtorHttpResponse.Success(response.body())
in 500..599 -> {
android.util.Log.w("POLL_DEBUG", "safePost ServerError: $statusCode")
KtorHttpResponse.ServerError(statusCode)
}
in 400..499 -> {
val bodyText = response.bodyAsText()
android.util.Log.w("POLL_DEBUG", "safePost ClientError: $statusCode body=$bodyText")
KtorHttpResponse.ClientError(statusCode)
}
else -> {
android.util.Log.w("POLL_DEBUG", "safePost Success: $statusCode")
KtorHttpResponse.Success(response.body())
}
}
} catch (e: IOException) {
android.util.Log.w("POLL_DEBUG", "safePost IOException: ${e.message}")
KtorHttpResponse.IOError(e)
} catch (e: Exception) {
android.util.Log.w("POLL_DEBUG", "safePost Exception: ${e.javaClass.simpleName}: ${e.message}")
KtorHttpResponse.UnknownException(e)
}
}
Expand Down
Loading