Search in sources :

Example 26 with DisabledOnOs

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

the class FilePermissionsTests method umaskForPath.

@Test
@DisabledOnOs(OS.WINDOWS)
void umaskForPath() throws IOException {
    FileAttribute<Set<PosixFilePermission>> fileAttribute = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-r-----"));
    Path tempFile = Files.createTempFile(this.tempDir, "umask", null, fileAttribute);
    assertThat(FilePermissions.umaskForPath(tempFile)).isEqualTo(0640);
}
Also used : Path(java.nio.file.Path) Set(java.util.Set) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 27 with DisabledOnOs

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

the class FileUtilTest method shouldCreateFileURIForFile.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldCreateFileURIForFile() {
    assertThat(FileUtil.toFileURI(new File("/var/lib/foo/"))).isEqualTo("file:///var/lib/foo");
    assertThat(FileUtil.toFileURI(new File("/var/a dir with spaces/foo"))).isEqualTo("file:///var/a%20dir%20with%20spaces/foo");
    assertThat(FileUtil.toFileURI(new File("/var/司徒空在此/foo"))).isEqualTo("file:///var/%E5%8F%B8%E5%BE%92%E7%A9%BA%E5%9C%A8%E6%AD%A4/foo");
}
Also used : File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 28 with DisabledOnOs

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

the class ArtifactsServiceTest method shouldProvideArtifactRootForAJobOnLinux.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldProvideArtifactRootForAJobOnLinux() throws Exception {
    assumeArtifactsRoot(fakeRoot);
    ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil);
    artifactsService.initialize();
    JobIdentifier oldId = new JobIdentifier("cruise", 1, "1.1", "dev", "2", "linux-firefox", null);
    when(resolverService.actualJobIdentifier(oldId)).thenReturn(new JobIdentifier("cruise", 2, "2.2", "functional", "3", "mac-safari"));
    String artifactRoot = artifactsService.findArtifactRoot(oldId);
    assertThat(artifactRoot).isEqualTo("pipelines/cruise/2/functional/3/mac-safari");
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 29 with DisabledOnOs

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

the class AgentLauncherImplTest method shouldDownload_AgentJar_IfTheCurrentJarIsStale.

@Test
@DisabledOnOs(OS.WINDOWS)
public void shouldDownload_AgentJar_IfTheCurrentJarIsStale() throws Exception {
    TEST_AGENT_LAUNCHER.copyTo(AGENT_LAUNCHER_JAR);
    File staleJar = randomFile(AGENT_BINARY_JAR);
    long original = staleJar.length();
    new AgentLauncherImpl().launch(launchDescriptor());
    assertThat(staleJar.length(), not(original));
}
Also used : File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 30 with DisabledOnOs

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

the class AgentBootstrapperFunctionalTest method shouldLoadAndBootstrapJarUsingAgentBootstrapCode_specifiedInAgentManifestFile.

@Test
@DisabledOnOs(OS.WINDOWS)
public void shouldLoadAndBootstrapJarUsingAgentBootstrapCode_specifiedInAgentManifestFile() throws Exception {
    PrintStream err = System.err;
    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        System.setErr(new PrintStream(os));
        File agentJar = new File("agent.jar");
        agentJar.delete();
        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));
        agentJar.delete();
        assertThat(os.toString(), containsString("Hello World Fellas!"));
    } finally {
        System.setErr(err);
    }
}
Also used : PrintStream(java.io.PrintStream) AgentBootstrapperArgs(com.thoughtworks.go.agent.common.AgentBootstrapperArgs) ByteArrayOutputStream(java.io.ByteArrayOutputStream) File(java.io.File) URL(java.net.URL) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Aggregations

DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)85 Test (org.junit.jupiter.api.Test)78 Path (java.nio.file.Path)38 File (java.io.File)24 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