-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-48138] Log a warning when fileExists called with empty…
… string
- Loading branch information
Showing
5 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/resources/org/jenkinsci/plugins/workflow/steps/Messages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,4 @@ | |||
ArtifactArchiverStepExecution.Deprecated=The 'archive' step is deprecated, please use 'archiveArtifacts' instead." | ArtifactArchiverStepExecution.Deprecated=The 'archive' step is deprecated, please use 'archiveArtifacts' instead." | ||
ArtifactArchiverStepExecution.NoFiles=No files found to archive for pattern "{0}", continuing. | ArtifactArchiverStepExecution.NoFiles=No files found to archive for pattern "{0}", continuing. | ||
ArtifactArchiverStepExecution.NoFilesWithExcludes=No files found to archive for pattern "{0}", excluding "{1}", continuing. | ArtifactArchiverStepExecution.NoFilesWithExcludes=No files found to archive for pattern "{0}", excluding "{1}", continuing. | ||
FileExistsStep.EmptyString=The 'fileExists' step was called with '', the empty string, so the current directory will be checked instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/java/org/jenkinsci/plugins/workflow/steps/FileExistsStepTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
package org.jenkinsci.plugins.workflow.steps; | |||
|
|||
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; | |||
import org.jenkinsci.plugins.workflow.job.WorkflowJob; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.runners.model.Statement; | |||
import org.jvnet.hudson.test.BuildWatcher; | |||
import org.jvnet.hudson.test.Issue; | |||
import org.jvnet.hudson.test.RestartableJenkinsRule; | |||
|
|||
public class FileExistsStepTest { | |||
|
|||
@ClassRule | |||
public static BuildWatcher buildWatcher = new BuildWatcher(); | |||
@Rule | |||
public RestartableJenkinsRule story = new RestartableJenkinsRule(); | |||
|
|||
@Issue("JENKINS-48138") | |||
@Test | |||
public void emptyStringWarning() { | |||
story.addStep(new Statement() { | |||
@Override | |||
public void evaluate() throws Throwable { | |||
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p"); | |||
p.setDefinition(new CpsFlowDefinition("node { fileExists('') }", true)); | |||
story.j.assertLogContains(Messages.FileExistsStep_EmptyString(), story.j.buildAndAssertSuccess(p)); | |||
} | |||
}); | |||
} | |||
} |