Search in sources :

Example 51 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class ExecTaskBuilderTest method shouldNormalizeWorkingDirectory.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldNormalizeWorkingDirectory() {
    ExecTask execTask = new ExecTask("ant", "", "folder\\child");
    CommandBuilder builder = (CommandBuilder) execTaskBuilder.createBuilder(builderFactory, execTask, pipelineStub("label", "."), resolver);
    assertThat(builder.getWorkingDir().getPath()).isEqualTo("./folder/child");
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 52 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project spring-boot by spring-projects.

the class BootBuildImageIntegrationTests method buildsImageWithBuildpackFromDirectory.

@TestTemplate
@DisabledOnOs(OS.WINDOWS)
void buildsImageWithBuildpackFromDirectory() throws IOException {
    writeMainClass();
    writeLongNameResource();
    writeBuildpackContent();
    BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT");
    String projectName = this.gradleBuild.getProjectDir().getName();
    assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
    assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
    assertThat(result.getOutput()).contains("---> Hello World buildpack");
    removeImages(projectName);
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) TestTemplate(org.junit.jupiter.api.TestTemplate)

Example 53 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class AgentBootstrapperFunctionalTest method shouldDownloadJarIfTheCurrentOneIsWrong.

@Test
@DisabledOnOs(OS.WINDOWS)
public void shouldDownloadJarIfTheCurrentOneIsWrong() throws Exception {
    File agentJar = new File("agent.jar");
    agentJar.delete();
    createRandomFile(agentJar);
    long original = agentJar.length();
    new AgentBootstrapper() {

        @Override
        void jvmExit(int returnValue) {
        }
    }.go(false, new AgentBootstrapperArgs().setServerUrl(new URL("http://" + "localhost" + ":" + server.getPort() + "/go")).setRootCertFile(null).setSslVerificationMode(AgentBootstrapperArgs.SslMode.NONE));
    assertThat(agentJar.length(), not(original));
    agentJar.delete();
}
Also used : AgentBootstrapperArgs(com.thoughtworks.go.agent.common.AgentBootstrapperArgs) File(java.io.File) URL(java.net.URL) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 54 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class CommandLineTest method shouldLogPasswordsOnOutputAsStarsUnderLinux.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldLogPasswordsOnOutputAsStarsUnderLinux() {
    CommandLine line = CommandLine.createCommandLine("echo").withArg("My Password is:").withArg(new PasswordArgument("secret")).withEncoding("utf-8");
    InMemoryStreamConsumer output = new InMemoryStreamConsumer();
    InMemoryStreamConsumer displayOutputStreamConsumer = InMemoryStreamConsumer.inMemoryConsumer();
    ProcessWrapper processWrapper = line.execute(output, new EnvironmentVariableContext(), null);
    processWrapper.waitForExit();
    assertThat(output.getAllOutput(), containsString("secret"));
    assertThat(displayOutputStreamConsumer.getAllOutput(), not(containsString("secret")));
}
Also used : ProcessWrapper(com.thoughtworks.go.util.ProcessWrapper) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 55 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class CommandLineTest method shouldBeAbleToRunCommandsFromRelativeDirectories.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldBeAbleToRunCommandsFromRelativeDirectories() throws IOException {
    File shellScript = Files.createFile(temporaryFolder.resolve("hello-world.sh")).toFile();
    FileUtils.writeStringToFile(shellScript, "echo ${PWD}", UTF_8);
    assertThat(shellScript.setExecutable(true), is(true));
    CommandLine line = CommandLine.createCommandLine("../hello-world.sh").withWorkingDir(subFolder).withEncoding("utf-8");
    InMemoryStreamConsumer out = new InMemoryStreamConsumer();
    line.execute(out, new EnvironmentVariableContext(), null).waitForExit();
    assertThat(out.getAllOutput().trim(), endsWith("subFolder"));
}
Also used : File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Aggregations

DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)87 Test (org.junit.jupiter.api.Test)80 Path (java.nio.file.Path)39 File (java.io.File)26 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 PathsBaseTest (org.assertj.core.internal.PathsBaseTest)12 AssertionsUtil.expectAssertionError (org.assertj.core.util.AssertionsUtil.expectAssertionError)11 PosixFilePermission (java.nio.file.attribute.PosixFilePermission)6 PageSwapperFactory (org.neo4j.io.pagecache.PageSwapperFactory)6 PageSwapperTest (org.neo4j.io.pagecache.PageSwapperTest)6 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)5 DelegatingStoreChannel (org.neo4j.io.fs.DelegatingStoreChannel)5 StoreChannel (org.neo4j.io.fs.StoreChannel)5 DisabledForRoot (org.neo4j.test.extension.DisabledForRoot)5 Closeable (java.io.Closeable)4 URI (java.net.URI)4 FileUtils.writeByteArrayToFile (org.apache.commons.io.FileUtils.writeByteArrayToFile)4 ShouldBeFile.shouldBeFile (org.assertj.core.error.ShouldBeFile.shouldBeFile)4 FilesBaseTest (org.assertj.core.internal.FilesBaseTest)4 Files.newFile (org.assertj.core.util.Files.newFile)4