use of com.hazelcast.simulator.coordinator.registry.TestData in project hazelcast-simulator by hazelcast.
the class Coordinator method testRun.
public String testRun(RcTestRunOperation op) {
LOGGER.info("Run starting...");
final RunTestSuiteTask runTestSuiteTask = createRunTestSuiteTask(op.getTestSuite());
if (op.isAsync()) {
if (op.getTestSuite().size() > 1) {
throw new IllegalArgumentException("1 test in testsuite allowed");
}
new Thread(new Runnable() {
@Override
public void run() {
runTestSuiteTask.run();
}
}).start();
for (; ; ) {
sleepSeconds(1);
for (TestData test : registry.getTests()) {
if (test.getTestSuite() == op.getTestSuite()) {
return test.getTestCase().getId();
}
}
}
} else {
boolean success = runTestSuiteTask.run();
LOGGER.info("Run complete!");
return success ? null : "Run completed with failures!";
}
}
use of com.hazelcast.simulator.coordinator.registry.TestData in project hazelcast-simulator by hazelcast.
the class FailureCollector method enrich.
private FailureOperation enrich(FailureOperation failure) {
String testId = failure.getTestId();
if (testId != null) {
TestData test = registry.getTest(testId);
if (test != null) {
failure.setTestCase(test.getTestCase());
failure.setDuration(System.currentTimeMillis() - test.getStartTimeMillis());
}
}
return failure;
}
use of com.hazelcast.simulator.coordinator.registry.TestData in project hazelcast-simulator by hazelcast.
the class Coordinator method stopTests.
private void stopTests() {
Collection<TestData> tests = registry.getTests();
for (TestData test : tests) {
test.setStopRequested(true);
}
for (int i = 0; i < testCompletionTimeoutSeconds; i++) {
Iterator<TestData> it = tests.iterator();
while (it.hasNext()) {
TestData test = it.next();
if (test.isCompleted()) {
it.remove();
}
}
sleepSeconds(1);
if (tests.isEmpty()) {
return;
}
}
LOGGER.info("The following tests failed to complete: " + tests);
}
use of com.hazelcast.simulator.coordinator.registry.TestData in project hazelcast-simulator by hazelcast.
the class Coordinator method testStop.
public String testStop(RcTestStopOperation op) throws Exception {
LOGGER.info(format("Test [%s] stopping...", op.getTestId()));
TestData test = registry.getTest(op.getTestId());
if (test == null) {
throw new IllegalStateException(format("no test with id [%s] found", op.getTestId()));
}
for (int i = 0; i < testCompletionTimeoutSeconds; i++) {
test.setStopRequested(true);
sleepSeconds(1);
if (test.isCompleted()) {
return test.getStatusString();
}
}
throw new Exception("Test failed to stop within " + testCompletionTimeoutSeconds + " seconds, current status: " + test.getStatusString());
}
use of com.hazelcast.simulator.coordinator.registry.TestData in project hazelcast-simulator by hazelcast.
the class RunTestSuiteTask method run0.
private boolean run0(List<TestData> tests, List<WorkerData> targets) {
int testCount = testSuite.size();
boolean parallel = testSuite.isParallel() && testCount > 1;
Map<TestPhase, CountDownLatch> testPhaseSyncMap = getTestPhaseSyncMap(testCount, parallel, coordinatorParameters.getLastTestPhaseToSync());
LOGGER.info("Starting TestSuite");
echoTestSuiteDuration(parallel);
for (TestData test : tests) {
int testIndex = test.getTestIndex();
TestCase testCase = test.getTestCase();
LOGGER.info(format("Configuration for %s (T%d):%n%s", testCase.getId(), testIndex, testCase));
TestCaseRunner runner = new TestCaseRunner(test, coordinatorParameters, targets, client, testPhaseSyncMap, failureCollector, registry, performanceStatsCollector);
runners.add(runner);
}
echoTestSuiteStart(testCount, parallel);
long started = System.nanoTime();
boolean success = parallel ? runParallel() : runSequential();
echoTestSuiteEnd(testCount, started);
return success;
}
Aggregations