Skip to content

Commit 9187a33

Browse files
committed
Update MeterPartitionTest for better testing robustness
1 parent 3113115 commit 9187a33

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

boot/src/test/kotlin/integration/meter/MeterPartitionTest.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import kotlinx.coroutines.delay
2525
import kotlinx.coroutines.runBlocking
2626
import org.junit.jupiter.api.Assertions.assertEquals
2727
import org.junit.jupiter.api.Assertions.assertNotNull
28-
import org.junit.jupiter.api.Disabled
2928
import org.junit.jupiter.api.Test
3029
import spp.protocol.instrument.LiveMeter
3130
import spp.protocol.instrument.location.LiveSourceLocation
@@ -36,16 +35,20 @@ import spp.protocol.view.LiveViewEvent
3635
import spp.protocol.view.rule.RulePartition
3736
import spp.protocol.view.rule.ViewRule
3837

39-
@Disabled //todo: this test is flaky
4038
class MeterPartitionTest : ProbeIntegrationTest() {
4139

4240
@Suppress("UNUSED_VARIABLE")
4341
private fun doTest(index: Int) {
4442
var i = index % 2 == 0
43+
addLineLabel("done") { Throwable().stackTrace[0].lineNumber }
4544
}
4645

4746
@Test
4847
fun `test meter partitions`(): Unit = runBlocking {
48+
setupLineLabels {
49+
doTest(-1)
50+
}
51+
4952
val liveMeter = LiveMeter(
5053
MeterType.COUNT,
5154
MetricValue(MetricValueType.NUMBER, "1"),
@@ -58,7 +61,7 @@ class MeterPartitionTest : ProbeIntegrationTest() {
5861
meta = mapOf("metric.mode" to "RATE"),
5962
location = LiveSourceLocation(
6063
MeterPartitionTest::class.java.name,
61-
43,
64+
getLineNumber("done"),
6265
"spp-test-probe"
6366
),
6467
id = testNameAsUniqueInstrumentId,

0 commit comments

Comments
 (0)