This file contains hidden or 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
class DevicePoolActor(private val poolId: DevicePoolId, ...) { | |
... | |
private val devices = mutableMapOf<String, SendChannel<DeviceEvent>>() | |
... | |
} |
This file contains hidden or 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
class CountShardingStrategy(val count: Int) : ShardingStrategy { | |
override fun createShard(tests: Collection<Test>): TestShard { | |
return TestShard(tests.flatMap { test -> | |
(0 until count).map { test } | |
}) | |
} | |
... | |
} |
This file contains hidden or 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
class OperatingSystemVersionPoolingStrategy : PoolingStrategy { | |
override fun associate(device: Device) = DevicePoolId(device.operatingSystem.version) | |
} |
This file contains hidden or 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
interface ShardingStrategy { | |
fun createShard(tests: Collection<Test>): TestShard | |
} |
This file contains hidden or 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
class ProbabilityBasedFlakinessStrategy(val minSuccessRate: Double, | |
val maxCount: Int, | |
val timeLimit: Instant) : FlakinessStrategy { | |
override fun process(testShard: TestShard, | |
metricsProvider: MetricsProvider): TestShard { | |
val tests = testShard.tests | |
val output = mutableListOf<Test>() | |
tests.forEach { | |
val successRate = metricsProvider.successRate(it, timeLimit) |
This file contains hidden or 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
interface SortingStrategy { | |
fun process(metricsProvider: MetricsProvider): Comparator<Test> | |
} |
This file contains hidden or 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
interface SortingStrategy { | |
fun process(metricsProvider: MetricsProvider): Comparator<Test> | |
} |
This file contains hidden or 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
class ExecutionTimeSortingStrategy(val percentile: Double, | |
val timeLimit: Instant) : SortingStrategy { | |
override fun process(metricsProvider: MetricsProvider): Comparator<Test> = | |
Comparator.comparingDouble<Test> { | |
val expectedDuration = metricsProvider.executionTime(it, percentile, timeLimit) | |
expectedDuration | |
}.reversed() | |
} |
This file contains hidden or 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
class IsolateBatchingStrategy : BatchingStrategy { | |
override fun process(queue: Queue<Test>, analytics: Analytics): TestBatch = TestBatch(listOf(queue.poll())) | |
} |
This file contains hidden or 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
class NoRetryStrategy : RetryStrategy { | |
override fun process(devicePoolId: DevicePoolId, tests: Collection<TestResult>, testShard: TestShard): List<TestResult> { | |
return emptyList() | |
} | |
} |