use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestManagerTest method test_startTestPhase.
@Test
public void test_startTestPhase() throws Exception {
TestCase testCase = new TestCase("foo").setProperty("threadCount", 1).setProperty("class", TestWithSlowSetup.class);
manager.createTest(new CreateTestOperation(testCase));
// then we call start; this call will not block
StubPromise promise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(SETUP, "foo"), promise);
// give the test some time to enter the setup phase
SECONDS.sleep(1);
assertFalse(promise.hasAnswer());
// but eventually the promise will complete.
promise.assertCompletesEventually();
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class WorkerOperationProcessorTest method test_StartTestPhaseOperation.
@Test
public void test_StartTestPhaseOperation() throws Exception {
StartPhaseOperation op = new StartPhaseOperation(TestPhase.GLOBAL_PREPARE, "foo");
processor.process(op, sourceAddress, promise);
verify(testManager).startTestPhase(op, promise);
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestManagerTest method test_startPhase_whenPreviousPhaseStillRunning.
@Test
public void test_startPhase_whenPreviousPhaseStillRunning() throws Exception {
TestCase testCase = new TestCase("foo").setProperty("threadCount", 1).setProperty("class", SuccessTest.class);
manager.createTest(new CreateTestOperation(testCase));
final TestContainer container = manager.getContainers().iterator().next();
// do the setup first (needed)
StubPromise setupPromise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(SETUP, "foo"), setupPromise);
setupPromise.assertCompletesEventually();
// then start with the run phase
manager.startTestPhase(new StartPhaseOperation(RUN, "foo"), mock(Promise.class));
awaitRunning(container);
// and while the run phase is running, we'll try to do a tear down
StubPromise promise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(LOCAL_TEARDOWN, "foo"), promise);
promise.assertCompletesEventually();
assertTrue(promise.getAnswer() instanceof IllegalStateException);
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestCaseRunner method executePhase.
private void executePhase(TestPhase phase) {
if (hasFailure()) {
throw new TestCaseAbortedException("Skipping Test " + phase.desc() + " (critical failure)", phase);
}
log("Starting Test " + phase.desc());
test.setTestPhase(phase);
Map<WorkerData, Future> futures = submitToTargets(phase.isGlobal(), new StartPhaseOperation(phase, testCase.getId()));
waitForPhaseCompletion(phase, futures);
log("Completed Test " + phase.desc());
waitForGlobalTestPhaseCompletion(phase);
}
Aggregations