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

Feature/save test finishing time epmdj 10980 #412

Merged
merged 8 commits into from
Feb 5, 2025
4 changes: 1 addition & 3 deletions admin-app/src/main/resources/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -894,9 +894,7 @@ components:
type: string
result:
$ref: '#/components/schemas/TestResult'
startedAt:
type: integer
finishedAt:
duration:
type: integer
details:
$ref: '#/components/schemas/TestDetails'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class TestLaunch (
val id: String,
val testDefinitionId: String,
val testSessionId: String,
val result: String?
val result: String?,
val duration: Int? = null,
)

class TestDefinition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TestLaunchRepositoryImpl: TestLaunchRepository {
this[TestLaunchTable.testDefinitionId] = it.testDefinitionId
this[TestLaunchTable.testSessionId] = it.testSessionId
this[TestLaunchTable.result] = it.result
this[TestLaunchTable.duration] = it.duration
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class TestLaunchInfo(
val testLaunchId: String,
val testDefinitionId: String,
val result: TestResult,
val startedAt: Long,
val finishedAt: Long,
val duration: Int? = null,
val details: TestDetails,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import com.epam.drill.admin.writer.rawdata.repository.*
import com.epam.drill.admin.writer.rawdata.route.payload.*
import com.epam.drill.admin.writer.rawdata.service.RawDataWriter
import com.epam.drill.admin.writer.rawdata.views.MethodIgnoreRuleView
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toJavaLocalDateTime
import kotlinx.datetime.toLocalDateTime
import kotlinx.datetime.*

private const val EXEC_DATA_BATCH_SIZE = 100

Expand Down Expand Up @@ -169,7 +167,8 @@ class RawDataServiceImpl(
id = test.testLaunchId,
testDefinitionId = test.testDefinitionId,
testSessionId = testsPayload.sessionId,
result = test.result.toString()
result = test.result.toString(),
duration = test.duration
)
}.let(testLaunchRepository::createMany)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ object TestLaunchTable : StringIdTable("raw_data.test_launches") {
val testDefinitionId = varchar("test_definition_id", SHORT_TEXT_LENGTH)
val testSessionId = varchar("test_session_id", SHORT_TEXT_LENGTH)
val result = varchar("result", SHORT_TEXT_LENGTH).nullable()
val duration = integer("duration").nullable()
val createdAt = datetime("created_at").defaultExpression(CurrentDateTime)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE raw_data.test_launches
ADD COLUMN IF NOT EXISTS duration INT DEFAULT NULL;