Search in sources :

Example 1 with TestData

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!";
    }
}
Also used : TestData(com.hazelcast.simulator.coordinator.registry.TestData) RunTestSuiteTask(com.hazelcast.simulator.coordinator.tasks.RunTestSuiteTask)

Example 2 with TestData

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;
}
Also used : TestData(com.hazelcast.simulator.coordinator.registry.TestData)

Example 3 with TestData

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);
}
Also used : TestData(com.hazelcast.simulator.coordinator.registry.TestData)

Example 4 with TestData

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());
}
Also used : TestData(com.hazelcast.simulator.coordinator.registry.TestData) CommandLineExitException(com.hazelcast.simulator.utils.CommandLineExitException) RemoteException(java.rmi.RemoteException) AlreadyBoundException(java.rmi.AlreadyBoundException)

Example 5 with TestData

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;
}
Also used : TestData(com.hazelcast.simulator.coordinator.registry.TestData) TestCase(com.hazelcast.simulator.common.TestCase) TestPhase(com.hazelcast.simulator.common.TestPhase) TestCaseRunner(com.hazelcast.simulator.coordinator.TestCaseRunner) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

TestData (com.hazelcast.simulator.coordinator.registry.TestData)5 TestCase (com.hazelcast.simulator.common.TestCase)1 TestPhase (com.hazelcast.simulator.common.TestPhase)1 TestCaseRunner (com.hazelcast.simulator.coordinator.TestCaseRunner)1 RunTestSuiteTask (com.hazelcast.simulator.coordinator.tasks.RunTestSuiteTask)1 CommandLineExitException (com.hazelcast.simulator.utils.CommandLineExitException)1 AlreadyBoundException (java.rmi.AlreadyBoundException)1 RemoteException (java.rmi.RemoteException)1 CountDownLatch (java.util.concurrent.CountDownLatch)1