You've already forked jenkins-lib
mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2025-08-25 20:09:25 +02:00
refactoring
This commit is contained in:
@@ -2,12 +2,12 @@ package ru.pulsar.jenkins.library.configuration
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription
|
||||
|
||||
class StepCoverageOptions {
|
||||
class StepCoverageOptions implements Serializable {
|
||||
|
||||
@JsonPropertyDescription("Выполнять замер покрытия")
|
||||
Boolean coverage = false
|
||||
|
||||
@JsonPropertyDescription("Порт, на котором будет запущен сервер отладки для замера покрытия")
|
||||
int dbgsPort = 1550
|
||||
Integer dbgsPort = 1550
|
||||
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ class Bdd implements Serializable, Coverable {
|
||||
def coverageContext = CoverageUtils.prepareContext(config, options)
|
||||
|
||||
steps.lock(coverageContext.lockableResource) {
|
||||
if (coverageContext != null) {
|
||||
CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this)
|
||||
if (options.coverage) {
|
||||
CoverageContext.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this)
|
||||
}
|
||||
|
||||
config.bddOptions.vrunnerSteps.each {
|
||||
@@ -65,7 +65,7 @@ class Bdd implements Serializable, Coverable {
|
||||
Logger.println("Тестирование сценариев завершилось успешно")
|
||||
}
|
||||
|
||||
if (coverageContext != null) {
|
||||
if (options.coverage) {
|
||||
CoverageUtils.stopCoverage(steps, coverageOpts, coverageContext)
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class CoverageCleanup implements Serializable {
|
||||
|
||||
Logger.printLocation()
|
||||
|
||||
String pidsFilePath = "build/$stageName-pids"
|
||||
String pidsFilePath = "build${File.separator}${stageName}-pids"
|
||||
|
||||
def pids = ""
|
||||
if (steps.fileExists(pidsFilePath)) {
|
||||
@@ -35,16 +35,15 @@ class CoverageCleanup implements Serializable {
|
||||
}
|
||||
|
||||
Logger.println("Завершение процессов dbgs и Coverage41C с pid: $pids")
|
||||
|
||||
def command
|
||||
if (steps.isUnix()) {
|
||||
def command = "kill $pids"
|
||||
steps.sh(command, true, false, encoding)
|
||||
command = "kill $pids"
|
||||
} else {
|
||||
def winCommand = pids.split(" ")
|
||||
def pidsForCmd = pids.split(" ")
|
||||
.each { it -> "/PID $it" }
|
||||
.join(" ")
|
||||
def command = "taskkill $winCommand /F"
|
||||
steps.sh(command, true, false, encoding)
|
||||
command = "taskkill $pidsForCmd /F"
|
||||
}
|
||||
steps.cmd(command, true, false)
|
||||
}
|
||||
}
|
||||
|
@@ -111,15 +111,15 @@ class SmokeTest implements Serializable, Coverable {
|
||||
def coverageContext = CoverageUtils.prepareContext(config, options)
|
||||
|
||||
steps.lock(coverageContext.lockableResource) {
|
||||
if (coverageContext != null) {
|
||||
CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this)
|
||||
if (options.coverage) {
|
||||
CoverageContext.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this)
|
||||
}
|
||||
|
||||
steps.withEnv(logosConfig) {
|
||||
VRunner.exec(command, true)
|
||||
}
|
||||
|
||||
if (coverageContext != null) {
|
||||
if (options.coverage) {
|
||||
CoverageUtils.stopCoverage(steps, coverageOpts, coverageContext)
|
||||
}
|
||||
}
|
||||
|
@@ -73,8 +73,8 @@ class Yaxunit implements Serializable, Coverable {
|
||||
def coverageContext = CoverageUtils.prepareContext(config, options)
|
||||
|
||||
steps.lock(coverageContext.lockableResource) {
|
||||
if (coverageContext != null) {
|
||||
CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this)
|
||||
if (options.coverage) {
|
||||
CoverageContext.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this)
|
||||
}
|
||||
|
||||
// Выполняем команды
|
||||
@@ -82,7 +82,7 @@ class Yaxunit implements Serializable, Coverable {
|
||||
VRunner.exec(runTestsCommand, true)
|
||||
}
|
||||
|
||||
if (coverageContext != null) {
|
||||
if (options.coverage) {
|
||||
CoverageUtils.stopCoverage(steps, coverageOpts, coverageContext)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user