File tree Expand file tree Collapse file tree 3 files changed +29
-18
lines changed
AndroidXCI/lib/src/main/kotlin/dev/androidx/ci Expand file tree Collapse file tree 3 files changed +29
-18
lines changed Original file line number Diff line number Diff line change 1717package dev.androidx.ci.config
1818
1919import com.google.auth.Credentials
20+ import okhttp3.Dispatcher
2021import okhttp3.logging.HttpLoggingInterceptor
2122
2223/* *
@@ -44,6 +45,7 @@ internal class Config {
4445 val gcp : Gcp ,
4546 val endPoint : String = " https://testing.googleapis.com/v1/" ,
4647 val httpLogLevel : HttpLoggingInterceptor .Level = HttpLoggingInterceptor .Level .NONE ,
48+ val dispatcher : Dispatcher = Dispatcher ()
4749 )
4850 class Datastore (
4951 val gcp : Gcp ,
Original file line number Diff line number Diff line change @@ -68,23 +68,26 @@ internal interface FirebaseTestLabApi {
6868 fun build (
6969 config : Config .FirebaseTestLab
7070 ): FirebaseTestLabApi {
71- val client = OkHttpClient .Builder ().authenticateWith(
72- config.gcp
73- ).addInterceptor {
74- val newBuilder = it.request().newBuilder()
75- newBuilder.addHeader(
76- " Content-Type" , " application/json;charset=utf-8" ,
77- )
78- newBuilder.addHeader(
79- " Accept" , " application/json"
80- )
81- it.proceed(
82- newBuilder.build()
83- )
84- }.withLog4J(
85- level = config.httpLogLevel,
86- klass = FirebaseTestLabApi ::class
87- ).build()
71+ val client = OkHttpClient
72+ .Builder ()
73+ .dispatcher(config.dispatcher)
74+ .authenticateWith(
75+ config.gcp
76+ ).addInterceptor {
77+ val newBuilder = it.request().newBuilder()
78+ newBuilder.addHeader(
79+ " Content-Type" , " application/json;charset=utf-8" ,
80+ )
81+ newBuilder.addHeader(
82+ " Accept" , " application/json"
83+ )
84+ it.proceed(
85+ newBuilder.build()
86+ )
87+ }.withLog4J(
88+ level = config.httpLogLevel,
89+ klass = FirebaseTestLabApi ::class
90+ ).build()
8891 val moshi = Moshi .Builder ()
8992 .add(MetadataKotlinJsonAdapterFactory ())
9093 .build()
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import dev.androidx.ci.testRunner.vo.RemoteApk
1818import dev.androidx.ci.testRunner.vo.UploadedApk
1919import kotlinx.coroutines.CoroutineDispatcher
2020import kotlinx.coroutines.Dispatchers
21+ import okhttp3.Dispatcher
2122import okhttp3.logging.HttpLoggingInterceptor
2223import java.io.InputStream
2324
@@ -173,7 +174,11 @@ interface TestRunnerService {
173174 * You may want to modify this if you want to use the same GCP account for isolated
174175 * test runs.
175176 */
176- testRunDataStoreObjectKind : String = AOSP_OBJECT_KIND
177+ testRunDataStoreObjectKind : String = AOSP_OBJECT_KIND ,
178+ /* *
179+ * Dispatcher for making api calls to FTL
180+ */
181+ dispatcher : Dispatcher = Dispatcher ()
177182 ): TestRunnerService {
178183 val httpLogLevel = if (logHttpCalls) {
179184 HttpLoggingInterceptor .Level .BODY
@@ -211,6 +216,7 @@ interface TestRunnerService {
211216 config = Config .FirebaseTestLab (
212217 gcp = gcpConfig,
213218 httpLogLevel = httpLogLevel,
219+ dispatcher = dispatcher
214220 )
215221 ),
216222 gcsResultPath = gcsResultPath
You can’t perform that action at this time.
0 commit comments