use of com.hazelcast.simulator.coordinator.operations.FailureOperation in project hazelcast-simulator by hazelcast.
the class FailureCollectorTest method notify_whenNonExistingWorker_thenIgnore.
@Test
public void notify_whenNonExistingWorker_thenIgnore() {
SimulatorAddress nonExistingWorkerAddress = workerAddress(agentAddress.getAgentIndex(), 100);
FailureOperation failure = new FailureOperation("exception", WORKER_EXCEPTION, nonExistingWorkerAddress, agentAddress.toString(), "workerId", "testId", null);
failureCollector.notify(failure);
assertEquals(0, failureCollector.getFailureCount());
}
use of com.hazelcast.simulator.coordinator.operations.FailureOperation in project hazelcast-simulator by hazelcast.
the class FailureCollectorTest method notify_enrich.
@Test
public void notify_enrich() {
TestCase testCase = new TestCase("test1");
TestSuite suite1 = new TestSuite().addTest(testCase);
TestSuite suite2 = new TestSuite().addTest(new TestCase("test2"));
registry.addTests(suite1);
registry.addTests(suite2);
FailureOperation failure = new FailureOperation("exception", WORKER_EXCEPTION, workerAddress, agentAddress.toString(), "workerId", testCase.getId(), null);
FailureListener listener = mock(FailureListener.class);
failureCollector.addListener(listener);
failureCollector.notify(failure);
ArgumentCaptor<FailureOperation> failureCaptor = ArgumentCaptor.forClass(FailureOperation.class);
verify(listener).onFailure(failureCaptor.capture(), eq(false), eq(true));
assertSame(suite1.getTestCaseList().get(0), failureCaptor.getValue().getTestCase());
}
use of com.hazelcast.simulator.coordinator.operations.FailureOperation in project hazelcast-simulator by hazelcast.
the class WorkerProcessFailureHandler method handle.
public void handle(String message, FailureType type, WorkerProcess workerProcess, String testId, String cause) {
SimulatorAddress workerAddress = workerProcess.getAddress();
String workerId = workerProcess.getId();
FailureOperation failure = new FailureOperation(message, type, workerAddress, agentAddress, workerId, testId, cause);
if (type.isPoisonPill()) {
LOGGER.info(format("Worker %s (%s) finished.", workerId, workerAddress));
} else {
LOGGER.error(format("Detected failure on Worker %s (%s): %s", workerId, workerAddress, failure.getLogMessage(++failureCount)));
}
server.sendCoordinator(failure);
}
use of com.hazelcast.simulator.coordinator.operations.FailureOperation in project hazelcast-simulator by hazelcast.
the class FailureCollectorTest method before.
@Before
public void before() {
outputDirectory = TestUtils.createTmpDirectory();
registry = new Registry();
failureCollector = new FailureCollector(outputDirectory, registry);
agentAddress = registry.addAgent("192.168.0.1", "192.168.0.1").getAddress();
workerAddress = workerAddress(agentAddress.getAgentIndex(), 1);
WorkerParameters workerParameters = new WorkerParameters().set("WORKER_ADDRESS", workerAddress);
registry.addWorkers(singletonList(workerParameters));
exceptionFailure = new FailureOperation("exception", WORKER_EXCEPTION, workerAddress, agentAddress.toString(), "workerId", "testId", null);
abnormalExitFailure = new FailureOperation("exception", WORKER_ABNORMAL_EXIT, workerAddress, agentAddress.toString(), "workerId", "testId", null);
oomeFailure = new FailureOperation("oom", WORKER_OOME, workerAddress, agentAddress.toString(), "workerId", "testId", null);
normalExitFailure = new FailureOperation("finished", WORKER_NORMAL_EXIT, workerAddress, agentAddress.toString(), "workerId", "testId", null);
}
use of com.hazelcast.simulator.coordinator.operations.FailureOperation in project hazelcast-simulator by hazelcast.
the class CoordinatorOperationProcessor method process.
@Override
public void process(SimulatorOperation op, SimulatorAddress source, Promise promise) throws Exception {
if (op instanceof FailureOperation) {
failureCollector.notify((FailureOperation) op);
} else if (op instanceof PerformanceStatsOperation) {
performanceStatsCollector.update(source, ((PerformanceStatsOperation) op).getPerformanceStats());
} else if (op instanceof LogOperation) {
LogOperation logOperation = (LogOperation) op;
LOGGER.log(logOperation.getLevel(), logOperation.getMessage());
} else {
throw new ProcessException("Unknown operation:" + op);
}
promise.answer("ok");
}
Aggregations