Search in sources :

Example 21 with SFinishedBuild

use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.

the class PowerShellIntegrationTests method should_run_simple_command_file_ps1.

@Test(dataProvider = "supportedBitnessProvider")
@TestFor(issues = "TW-29803")
public void should_run_simple_command_file_ps1(@NotNull final PowerShellBitness bits) throws Throwable {
    final File dir = createTempDir();
    final File code = new File(dir, "code.ps1");
    FileUtil.writeFileAndReportErrors(code, "echo works");
    setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.PS1.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.FILE.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_FILE, code.getPath());
    setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bits.getValue());
    final SFinishedBuild build = doTest(null);
    dumpBuildLogLocally(build);
    Assert.assertTrue(build.getBuildStatus().isSuccessful());
    Assert.assertTrue(getBuildLog(build).contains("works"));
}
Also used : SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 22 with SFinishedBuild

use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.

the class PowerShellIntegrationTests method should_run_simple_command_file_stdin.

@Test(dataProvider = "supportedBitnessProvider")
@TestFor(issues = "TW-29803")
public void should_run_simple_command_file_stdin(@NotNull final PowerShellBitness bits) throws Throwable {
    final File code = createTempFile("echo works");
    setRunnerParameter(PowerShellConstants.RUNNER_MIN_VERSION, "2.0");
    setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.STDIN.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.FILE.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_FILE, code.getPath());
    setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bits.getValue());
    final SFinishedBuild build = doTest(null);
    dumpBuildLogLocally(build);
    Assert.assertTrue(build.getBuildStatus().isSuccessful());
    Assert.assertTrue(getBuildLog(build).contains("works"));
}
Also used : SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 23 with SFinishedBuild

use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.

the class PowerShellIntegrationTests method testMultilineArguments.

@SuppressWarnings("TestMethodWithIncorrectSignature")
@Test(dataProvider = "supportedBitnessProvider")
@TestFor(issues = "TW-65627")
public void testMultilineArguments(@NotNull final PowerShellBitness bits) throws Throwable {
    setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.PS1.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.CODE.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_CODE, "param(\n" + "\t[string] $param1 = \"\"\n" + ")\n" + "\n" + "Write-Output \"praram1: $param1.\"");
    setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bits.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_ARGUMENTS, "-param1 \"line1a = line1b\nline2a = line2b\"");
    setBuildConfigurationParameter(PowerShellConstants.PARAM_ARGS_MULTILINE, "true");
    final SFinishedBuild build = doTest(null);
    dumpBuildLogLocally(build);
    Assert.assertTrue(build.getBuildStatus().isSuccessful());
    Assert.assertTrue(getBuildLog(build).contains("\"line1a = line1b line2a = line2b\""));
    Assert.assertTrue(getBuildLog(build).contains("praram1: line1a = line1b line2a = line2b."));
}
Also used : SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 24 with SFinishedBuild

use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.

the class PowerShellIntegrationTests method should_proper_bitness_run.

@Test(dataProvider = "supportedBitnessProvider")
public void should_proper_bitness_run(@NotNull final PowerShellBitness bits) throws Throwable {
    setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.PS1.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.CODE.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_CODE, "Write-Host \"ptr: $([IntPtr]::size)\"\r\n");
    setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bits.getValue());
    final SFinishedBuild build = doTest(null);
    dumpBuildLogLocally(build);
    Assert.assertTrue(build.getBuildStatus().isSuccessful());
    final String output = bits == PowerShellBitness.x64 ? "8" : "4";
    Assert.assertTrue(getBuildLog(build).contains("ptr: " + output + " NO"));
}
Also used : SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) Test(org.testng.annotations.Test)

Example 25 with SFinishedBuild

use of jetbrains.buildServer.serverSide.SFinishedBuild in project teamcity-powershell by JetBrains.

the class PowerShellIntegrationTests method testShouldKeepGeneratedFiles_Global.

@SuppressWarnings("TestMethodWithIncorrectSignature")
@Test(dataProvider = "supportedBitnessProvider")
@TestFor(issues = { "TW-39841", "TW-49772" })
public void testShouldKeepGeneratedFiles_Global(@NotNull final PowerShellBitness bits) throws Throwable {
    setRunnerParameter(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.PS1.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.CODE.getValue());
    setRunnerParameter(PowerShellConstants.RUNNER_SCRIPT_CODE, "echo works\r\n");
    setRunnerParameter(PowerShellConstants.RUNNER_BITNESS, bits.getValue());
    setBuildConfigurationParameter("teamcity.dont.delete.temp.files", "true");
    final SFinishedBuild build = doTest(null);
    assertEquals(1, getTempFiles().length);
    dumpBuildLogLocally(build);
    Assert.assertTrue(build.getBuildStatus().isSuccessful());
    Assert.assertTrue(getBuildLog(build).contains("works"));
}
Also used : SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Aggregations

SFinishedBuild (jetbrains.buildServer.serverSide.SFinishedBuild)34 Test (org.testng.annotations.Test)32 TestFor (jetbrains.buildServer.util.TestFor)12 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)9 FakeHttpServletRequest (jetbrains.buildServer.controllers.fakes.FakeHttpServletRequest)7 TestOccurrences (jetbrains.buildServer.server.rest.model.problem.TestOccurrences)7 TestScope (jetbrains.buildServer.server.rest.data.problem.scope.TestScope)4 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 TestOccurrence (jetbrains.buildServer.server.rest.model.problem.TestOccurrence)3 BeanContext (jetbrains.buildServer.server.rest.util.BeanContext)2 ProjectEx (jetbrains.buildServer.serverSide.impl.ProjectEx)2 SkipException (org.testng.SkipException)2 BufferedImage (java.awt.image.BufferedImage)1 SUserGroup (jetbrains.buildServer.groups.SUserGroup)1 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)1 Build (jetbrains.buildServer.server.rest.model.build.Build)1 User (jetbrains.buildServer.server.rest.model.user.User)1 BuildPromotionEx (jetbrains.buildServer.serverSide.BuildPromotionEx)1 BuildTypeEx (jetbrains.buildServer.serverSide.BuildTypeEx)1