Skip to content

Commit

Permalink
CLOUDSTACK-9299: Fix test failures on CI
Browse files Browse the repository at this point in the history
- Fixes oobm integration test to skip if known ipmitool bug is hit
- Fixes ProcessTest unit test case to use sleep
- Removes redundant unit test that covers code in ProcessTest

Signed-off-by: Rohit Yadav <[email protected]>
  • Loading branch information
rohityadavcloud committed May 13, 2016
1 parent 540d957 commit ae0f169
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
import com.cloud.utils.exception.CloudRuntimeException;
import com.google.common.collect.ImmutableMap;
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagement;
import org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverResponse;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -105,11 +103,4 @@ public void testFindIpmiUserValid() {
Assert.assertEquals(IPMITOOL.findIpmiUser(usersList, "operator"), "2");
Assert.assertEquals(IPMITOOL.findIpmiUser(usersList, "user"), "3");
}

@Test
public void testExecuteCommands() {
OutOfBandManagementDriverResponse r = IPMITOOL.executeCommands(Arrays.asList("ls", "/tmp"));
Assert.assertTrue(r.isSuccess());
Assert.assertTrue(r.getResult().length() > 0);
}
}
}
9 changes: 7 additions & 2 deletions test/integration/smoke/test_outofbandmanagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,13 @@ def test_oobm_zchange_password(self):
cmd = changeOutOfBandManagementPassword.changeOutOfBandManagementPasswordCmd()
cmd.hostid = self.getHost().id
cmd.password = "Password12345"
response = self.apiclient.changeOutOfBandManagementPassword(cmd)
self.assertEqual(response.status, True)
try:
response = self.apiclient.changeOutOfBandManagementPassword(cmd)
self.assertEqual(response.status, True)
except Exception as e:
if "packet session id 0x0 does not match active session" in str(e):
raise self.skipTest("Known ipmitool issue hit, skipping test")
raise e

bmc = IpmiServerContext().bmc
bmc.powerstate = 'on'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ public class ProcessTest {

@Test
public void testProcessRunner() {
ProcessResult result = RUNNER.executeCommands(Arrays.asList("ls", "/tmp"));
ProcessResult result = RUNNER.executeCommands(Arrays.asList("sleep", "0"));
Assert.assertEquals(result.getReturnCode(), 0);
Assert.assertTrue(Strings.isNullOrEmpty(result.getStdError()));
Assert.assertTrue(result.getStdOutput().length() > 0);
}

@Test
Expand Down

0 comments on commit ae0f169

Please sign in to comment.