Skip to content

Commit

Permalink
fix date comparision, fix step naming (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
MxEh-TT committed Jul 15, 2024
1 parent ffb517b commit ea08671
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.jenkinsci.plugins.workflow.steps.StepExecution
import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution
import org.kohsuke.stapler.DataBoundConstructor

import java.text.SimpleDateFormat
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream

Expand Down Expand Up @@ -162,19 +163,20 @@ class ProvideLogsStep extends Step {

boolean checkReportFolderCreationDate(String reportDir) {
def df = "yyyy-MM-dd_HHmmss"
SimpleDateFormat dateFormat = new SimpleDateFormat(df)
def pattern = /\d{4}-\d{2}-\d{2}_\d{6}/
def matcher = reportDir =~ pattern
if (matcher) {
def date = matcher[0]
Date dateTime1 = new Date().parse(df, date)
if (matcher.find()) {
def matchedText = matcher.group(0)
Date dateTime1 = dateFormat.parse(matchedText)
Date dateTime2 = new Date(startTimeMillis)
return dateTime1 > dateTime2
} else {
throw new Exception("No date and time found in the input string.")
}
}

File extractLogFileFromZip(File reportFolderZip, String fileNameToExtract, String saveToPath) {
static File extractLogFileFromZip(File reportFolderZip, String fileNameToExtract, String saveToPath) {
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(reportFolderZip))
ZipEntry entry
while ((entry = zipInputStream.nextEntry) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ETV1ContainerTest extends ETContainerTest {
node {
withEnv(['ET_API_HOSTNAME=${etContainer.host}', 'ET_API_PORT=${etContainer.getMappedPort(ET_PORT)}']) {
ttRunPackage testCasePath: 'test.pkg'
ttProvideReportLogs()
ttProvideLogs()
}
}
""".stripIndent()
Expand Down

0 comments on commit ea08671

Please sign in to comment.