use of org.junit.jupiter.api.condition.EnabledOnOs in project spring-boot by spring-projects.
the class FilePermissionsTests method umaskForPathOnWindowsFails.
@Test
@EnabledOnOs(OS.WINDOWS)
void umaskForPathOnWindowsFails() throws IOException {
Path tempFile = Files.createTempFile("umask", null);
assertThatIllegalStateException().isThrownBy(() -> FilePermissions.umaskForPath(tempFile)).withMessageContaining("Unsupported file type for retrieving Posix attributes");
}
use of org.junit.jupiter.api.condition.EnabledOnOs in project gocd by gocd.
the class ArtifactsServiceTest method shouldProvideArtifactRootForAJobOnWindows.
@Test
@EnabledOnOs(OS.WINDOWS)
void shouldProvideArtifactRootForAJobOnWindows() 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", 1, "1.1", "dev", "2", "linux-firefox", null));
String artifactRoot = artifactsService.findArtifactRoot(oldId);
assertThat(artifactRoot).isEqualTo("pipelines\\cruise\\1\\dev\\2\\linux-firefox");
}
use of org.junit.jupiter.api.condition.EnabledOnOs in project gocd by gocd.
the class ZipUtilTest method shouldZipFileWhoseNameHasSpecialCharactersOnLinux.
@Test
@EnabledOnOs(OS.LINUX)
void shouldZipFileWhoseNameHasSpecialCharactersOnLinux() throws IOException {
File specialFile = new File(srcDir, "$`#?@!()?-_{}^'~.+=[];,a.txt");
FileUtils.writeStringToFile(specialFile, "specialFile", UTF_8);
zipFile = zipUtil.zip(srcDir, createFileInTempDir(), Deflater.NO_COMPRESSION);
zipUtil.unzip(zipFile, destDir);
File baseDir = new File(destDir, srcDir.getName());
File actualSpecialFile = new File(baseDir, specialFile.getName());
assertThat(actualSpecialFile.isFile()).isTrue();
assertThat(fileContent(actualSpecialFile)).isEqualTo(fileContent(specialFile));
}
use of org.junit.jupiter.api.condition.EnabledOnOs in project gocd by gocd.
the class CommandLineTest method shouldLogPasswordsOnOutputAsStarsUnderWindows.
@Test
@EnabledOnOs(OS.WINDOWS)
void shouldLogPasswordsOnOutputAsStarsUnderWindows() {
CommandLine line = CommandLine.createCommandLine("cmd").withEncoding("utf-8").withArg("/c").withArg("echo").withArg("My Password is:").withArg(new PasswordArgument("secret"));
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")));
}
use of org.junit.jupiter.api.condition.EnabledOnOs in project gocd by gocd.
the class CommandBuilderTest method commandWithArgs_shouldAddCmdBeforeAWindowsCommand.
@Test
@EnabledOnOs(OS.WINDOWS)
void commandWithArgs_shouldAddCmdBeforeAWindowsCommand() {
CommandBuilder commandBuilder = new CommandBuilder("echo", "some thing", tempWorkDir, null, null, "some desc");
CommandLine commandLine = commandBuilder.buildCommandLine();
assertThat(commandLine.toStringForDisplay()).isEqualTo("cmd /c echo some thing");
}
Aggregations