Skip to content

Commit

Permalink
[core] Disable BashCommandsIntegrationTest test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kemitix committed Nov 6, 2018
1 parent c5a851d commit 2ba7ce6
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import org.apache.brooklyn.core.test.BrooklynMgmtUnitTestSupport;
import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
import org.apache.brooklyn.test.DisableOnWindows;
import org.apache.brooklyn.util.core.ResourceUtils;
import org.apache.brooklyn.util.core.task.BasicExecutionContext;
import org.apache.brooklyn.util.core.task.ssh.SshTasks;
Expand Down Expand Up @@ -133,6 +134,7 @@ public void tearDown() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testRemoveRequireTtyFromSudoersFile() throws Exception {
String cmds = BashCommands.dontRequireTtyForSudo();

Expand All @@ -154,6 +156,7 @@ public void testRemoveRequireTtyFromSudoersFile() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a whoami command available on localhost")
public void testSudo() throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
ByteArrayOutputStream errStream = new ByteArrayOutputStream();
Expand All @@ -177,6 +180,7 @@ public void testDownloadUrl() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testDownloadFirstSuccessfulFile() throws Exception {
List<String> cmds = BashCommands.commandsToDownloadUrlsAs(
ImmutableList.of(sourceNonExistantFileUrl, sourceFileUrl1, sourceFileUrl2),
Expand All @@ -188,6 +192,7 @@ public void testDownloadFirstSuccessfulFile() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testDownloadToStdout() throws Exception {
ProcessTaskWrapper<String> t = SshTasks.newSshExecTaskFactory(loc,
"cd "+destFile.getParentFile().getAbsolutePath(),
Expand All @@ -199,6 +204,7 @@ public void testDownloadToStdout() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testAlternativesWhereFirstSucceeds() throws Exception {
ProcessTaskWrapper<Integer> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.alternatives(Arrays.asList("echo first", "exit 88")))
Expand All @@ -213,6 +219,7 @@ public void testAlternativesWhereFirstSucceeds() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testAlternatives() throws Exception {
ProcessTaskWrapper<Integer> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.alternatives(Arrays.asList("asdfj_no_such_command_1", "exit 88")))
Expand All @@ -224,6 +231,7 @@ public void testAlternatives() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testRequireTestHandlesFailure() throws Exception {
ProcessTaskWrapper<?> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.requireTest("-f "+sourceNonExistantFile.getPath(),
Expand All @@ -236,6 +244,7 @@ public void testRequireTestHandlesFailure() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testRequireTestHandlesSuccess() throws Exception {
ProcessTaskWrapper<?> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.requireTest("-f "+sourceFile1.getPath(),
Expand All @@ -247,6 +256,7 @@ public void testRequireTestHandlesSuccess() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testRequireFileHandlesFailure() throws Exception {
ProcessTaskWrapper<?> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.requireFile(sourceNonExistantFile.getPath())).newTask();
Expand All @@ -260,6 +270,7 @@ public void testRequireFileHandlesFailure() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testRequireFileHandlesSuccess() throws Exception {
ProcessTaskWrapper<?> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.requireFile(sourceFile1.getPath())).newTask();
Expand All @@ -270,6 +281,7 @@ public void testRequireFileHandlesSuccess() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost")
public void testRequireFailureExitsImmediately() throws Exception {
ProcessTaskWrapper<?> t = SshTasks.newSshExecTaskFactory(loc)
.add(BashCommands.requireTest("-f "+sourceNonExistantFile.getPath(),
Expand All @@ -284,6 +296,7 @@ public void testRequireFailureExitsImmediately() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testPipeMultiline() throws Exception {
String output = execRequiringZeroAndReturningStdout(loc,
BashCommands.pipeTextTo("hello world\n"+"and goodbye\n", "wc")).get();
Expand All @@ -292,6 +305,7 @@ public void testPipeMultiline() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForFileContentsWhenAbortingOnFail() throws Exception {
String fileContent = "mycontents";
String cmd = BashCommands.waitForFileContents(destFile.getAbsolutePath(), fileContent, Duration.ONE_SECOND, true);
Expand All @@ -305,6 +319,7 @@ public void testWaitForFileContentsWhenAbortingOnFail() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForFileContentsWhenNotAbortingOnFail() throws Exception {
String fileContent = "mycontents";
String cmd = BashCommands.waitForFileContents(destFile.getAbsolutePath(), fileContent, Duration.ONE_SECOND, false);
Expand All @@ -318,6 +333,7 @@ public void testWaitForFileContentsWhenNotAbortingOnFail() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForFileContentsWhenContentsAppearAfterStart() throws Exception {
String fileContent = "mycontents";

Expand All @@ -335,6 +351,7 @@ public void testWaitForFileContentsWhenContentsAppearAfterStart() throws Excepti
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForFileExistsWhenAbortingOnFail() throws Exception {
String cmd = BashCommands.waitForFileExists(destFile.getAbsolutePath(), Duration.ONE_SECOND, true);

Expand All @@ -347,6 +364,7 @@ public void testWaitForFileExistsWhenAbortingOnFail() throws Exception {
}

@Test(groups="Integration")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForFileExistsWhenNotAbortingOnFail() throws Exception {
String cmd = BashCommands.waitForFileExists(destFile.getAbsolutePath(), Duration.ONE_SECOND, false);

Expand All @@ -359,6 +377,7 @@ public void testWaitForFileExistsWhenNotAbortingOnFail() throws Exception {
}

@Test(groups="Integration", dependsOnMethods="testSudo")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForPortFreeWhenAbortingOnTimeout() throws Exception {
ServerSocket serverSocket = openServerSocket();
try {
Expand All @@ -378,6 +397,7 @@ public void testWaitForPortFreeWhenAbortingOnTimeout() throws Exception {
}

@Test(groups="Integration", dependsOnMethods="testSudo")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception {
ServerSocket serverSocket = openServerSocket();
try {
Expand All @@ -397,6 +417,7 @@ public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception {
}

@Test(groups="Integration", dependsOnMethods="testSudo")
@DisableOnWindows(reason = "Needs a bash shell available on localhost")
public void testWaitForPortFreeWhenFreedAfterStart() throws Exception {
ServerSocket serverSocket = openServerSocket();
try {
Expand Down

0 comments on commit 2ba7ce6

Please sign in to comment.