Skip to content
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ apacheHttpClientVersion = 5.2.3
aesyDatasizeVersion = 1.0.0
bytebuddyVersion = 1.14.11

sharedLibsRef = feature/max-retries-EPMDJ-10975
sharedLibsRef = main
sharedLibsLocalPath = lib-jvm-shared
nativeAgentLibName = drill-agent
nativeAgentHookEnabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Test2Code(
override fun processServerRequest() {
val sessionId = context()
val testId = context[DRILL_TEST_ID_HEADER]
if (sessionId == null || testId == null) return
if (sessionId == null && testId == null) return
coverageManager.startRecording(sessionId, testId)
}

Expand All @@ -102,7 +102,7 @@ class Test2Code(
override fun processServerResponse() {
val sessionId = context()
val testId = context[DRILL_TEST_ID_HEADER]
if (sessionId == null || testId == null) return
if (sessionId == null && testId == null) return
coverageManager.stopRecording(sessionId, testId)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package com.epam.drill.agent.test2code.coverage

interface ICoverageRecorder {
fun startRecording(sessionId: String, testId: String)
fun stopRecording(sessionId: String, testId: String)
fun startRecording(sessionId: String?, testId: String?)
Comment thread
iryabov marked this conversation as resolved.
fun stopRecording(sessionId: String?, testId: String?)
fun getContext(): ContextCoverage?
fun pollRecorded(): Sequence<ExecDatum>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ class IntervalCoverageSender(
* @features Coverage data sending
*/
private fun sendProbes(dataToSend: Sequence<ExecDatum>) {
dataToSend.map { ClassCoverage(classname = it.name, testId = it.testId, probes = it.probes.values.toBitSet()) }
dataToSend
.map { ClassCoverage(
classname = it.name,
testId = it.testId,
testSessionId = it.sessionId,
probes = it.probes.values.toBitSet()) }
.chunked(pageSize)
.forEach { sender.send(destination, CoveragePayload(groupId, appId, instanceId, it)) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class GlobalCoverageRecorder: ICoverageRecorder {
private val globalExecData: ExecData = ExecData()
private val sentGlobalExecData: ExecData = ExecData()

override fun startRecording(sessionId: String, testId: String) {
override fun startRecording(sessionId: String?, testId: String?) {
// do nothing
}

override fun stopRecording(sessionId: String, testId: String) {
override fun stopRecording(sessionId: String?, testId: String?) {
// do nothing
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ThreadCoverageRecorder(
private val context: ThreadLocal<ContextKey?> = ThreadLocal()
private val execData: ThreadLocal<ExecData?> = ThreadLocal()

override fun startRecording(sessionId: String, testId: String) {
override fun startRecording(sessionId: String?, testId: String?) {
val ctx = ContextKey(sessionId, testId)
context.set(ctx)
execData.set(execDataPool.getOrPut(
Expand All @@ -34,7 +34,7 @@ class ThreadCoverageRecorder(
logger.trace { "Test recording started (sessionId = $sessionId, testId = $testId, threadId = ${Thread.currentThread().id})." }
}

override fun stopRecording(sessionId: String, testId: String) {
override fun stopRecording(sessionId: String?, testId: String?) {
execDataPool.release(ContextKey(sessionId, testId), execData.get() ?: ExecData())
execData.remove()
context.remove()
Expand Down
Loading