Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set isRoboTest to true for robo tests #2535

Merged
merged 3 commits into from
Oct 28, 2024
Merged
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 @@ -45,7 +45,8 @@ private fun TestMatrix.Data.updateProperties(newMatrix: TestMatrix.Data) = copy(
testFileName = newMatrix.testFileName,
isCompleted = MatrixState.completed(state) &&
newMatrix.testExecutions.all { MatrixState.completed(it.state) },
testExecutions = newMatrix.testExecutions
testExecutions = newMatrix.testExecutions,
isRoboTest = newMatrix.isRoboTest,
)

private fun TestMatrix.Data.updateBillableMinutes(billableMinutes: TestMatrix.BillableMinutes) = copy(
Expand Down
24 changes: 24 additions & 0 deletions test_runner/src/test/kotlin/ftl/api/TestMatrixTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,30 @@ class TestMatrixTest {
val updatedMatrix = testMatrix.updateWithMatrix(ftlTestMatrix.toApiModel())
assertEquals("N/A", updatedMatrix.appFileName)
}

@Test
fun `isRoboTest property should update to true for Robo Test matrices`() {
val testExecutions = listOf(
createStepExecution(1, "shamu"),
createStepExecution(1, "NexusLowRes")
)

val matrixId = "123"
val ftlTestMatrix = ftlTestMatrix()
ftlTestMatrix.testMatrixId = matrixId
ftlTestMatrix.state = PENDING
ftlTestMatrix.resultStorage = createResultsStorage()
ftlTestMatrix.testExecutions = testExecutions

SelaseKay marked this conversation as resolved.
Show resolved Hide resolved
var testMatrix = ftlTestMatrix.toApiModel()
assert(!testMatrix.isRoboTest)

val newTestMatrix = ftlTestMatrix.toApiModel().copy(isRoboTest = true)
testMatrix = testMatrix.copy(state = FINISHED)
testMatrix = testMatrix.updateWithMatrix(newTestMatrix)

assert(testMatrix.isRoboTest) { "isRoboTest was not updated" }
}
}

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