Skip to content

Commit 7a9163b

Browse files
SelaseKayjude.kwashie
and
jude.kwashie
authored
fix: set isRoboTest to true for robo tests (#2535)
* fix: set isRoboTest to true for robo tests * test: add test to verify property updates for Robo Test matrices * test: add initial assertion to verify isRoboTest is false by default --------- Co-authored-by: jude.kwashie <[email protected]>
1 parent b40904b commit 7a9163b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

test_runner/src/main/kotlin/ftl/domain/testmatrix/UpdateTestMatrix.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ private fun TestMatrix.Data.updateProperties(newMatrix: TestMatrix.Data) = copy(
4545
testFileName = newMatrix.testFileName,
4646
isCompleted = MatrixState.completed(state) &&
4747
newMatrix.testExecutions.all { MatrixState.completed(it.state) },
48-
testExecutions = newMatrix.testExecutions
48+
testExecutions = newMatrix.testExecutions,
49+
isRoboTest = newMatrix.isRoboTest,
4950
)
5051

5152
private fun TestMatrix.Data.updateBillableMinutes(billableMinutes: TestMatrix.BillableMinutes) = copy(

test_runner/src/test/kotlin/ftl/api/TestMatrixTest.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,30 @@ class TestMatrixTest {
318318
val updatedMatrix = testMatrix.updateWithMatrix(ftlTestMatrix.toApiModel())
319319
assertEquals("N/A", updatedMatrix.appFileName)
320320
}
321+
322+
@Test
323+
fun `isRoboTest property should update to true for Robo Test matrices`() {
324+
val testExecutions = listOf(
325+
createStepExecution(1, "shamu"),
326+
createStepExecution(1, "NexusLowRes")
327+
)
328+
329+
val matrixId = "123"
330+
val ftlTestMatrix = ftlTestMatrix()
331+
ftlTestMatrix.testMatrixId = matrixId
332+
ftlTestMatrix.state = PENDING
333+
ftlTestMatrix.resultStorage = createResultsStorage()
334+
ftlTestMatrix.testExecutions = testExecutions
335+
336+
var testMatrix = ftlTestMatrix.toApiModel()
337+
assert(!testMatrix.isRoboTest)
338+
339+
val newTestMatrix = ftlTestMatrix.toApiModel().copy(isRoboTest = true)
340+
testMatrix = testMatrix.copy(state = FINISHED)
341+
testMatrix = testMatrix.updateWithMatrix(newTestMatrix)
342+
343+
assert(testMatrix.isRoboTest) { "isRoboTest was not updated" }
344+
}
321345
}
322346

323347
private inline fun ref(path: () -> String) = FileReference().apply { gcsPath = path() }

0 commit comments

Comments
 (0)