Search in sources :

Example 11 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class MultiControllerTest method initialize.

@Environment
public static void initialize() throws MarathonException, ExecutionException {
    URI zkUris = startZookeeperInstance();
    startBookkeeperInstances(zkUris);
    URI controllerUri = ensureControllerRunning(zkUris);
    log.info("Controller is currently running at {}", controllerUri);
    Service controllerService = Utils.createPravegaControllerService(zkUris);
    // With Kvs we need segment stores to be running.
    ensureSegmentStoreRunning(zkUris, controllerUri);
    // scale to two controller instances.
    Futures.getAndHandleExceptions(controllerService.scaleService(2), ExecutionException::new);
    List<URI> conUris = controllerService.getServiceDetails();
    log.debug("Pravega Controller service  details: {}", conUris);
}
Also used : Service(io.pravega.test.system.framework.services.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutionException(java.util.concurrent.ExecutionException) URI(java.net.URI) Environment(io.pravega.test.system.framework.Environment)

Example 12 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class MultiReaderTxnWriterWithFailoverTest method setup.

@Before
public void setup() {
    // Get zk details to verify if controller, SSS are running
    Service zkService = Utils.createZookeeperService();
    List<URI> zkUris = zkService.getServiceDetails();
    log.debug("Zookeeper service details: {}", zkUris);
    // get the zk ip details and pass it to  host, controller
    URI zkUri = zkUris.get(0);
    // Verify controller is running.
    controllerInstance = Utils.createPravegaControllerService(zkUri);
    assertTrue(controllerInstance.isRunning());
    List<URI> conURIs = controllerInstance.getServiceDetails();
    log.info("Pravega Controller service instance details: {}", conURIs);
    // Fetch all the RPC endpoints and construct the client URIs.
    final List<String> uris = conURIs.stream().filter(ISGRPC).map(URI::getAuthority).collect(Collectors.toList());
    controllerURIDirect = URI.create((Utils.TLS_AND_AUTH_ENABLED ? TLS : TCP) + String.join(",", uris));
    log.info("Controller Service direct URI: {}", controllerURIDirect);
    // Verify segment store is running.
    segmentStoreInstance = Utils.createPravegaSegmentStoreService(zkUri, controllerURIDirect);
    assertTrue(segmentStoreInstance.isRunning());
    log.info("Pravega Segmentstore service instance details: {}", segmentStoreInstance.getServiceDetails());
    // executor service
    executorService = ExecutorServiceHelpers.newScheduledThreadPool(NUM_READERS + NUM_WRITERS + 2, "MultiReaderTxnWriterWithFailoverTest-main");
    controllerExecutorService = ExecutorServiceHelpers.newScheduledThreadPool(2, "MultiReaderTxnWriterWithFailoverTest-controller");
    final ClientConfig clientConfig = Utils.buildClientConfig(controllerURIDirect);
    // get Controller Uri
    controller = new ControllerImpl(ControllerImplConfig.builder().clientConfig(clientConfig).maxBackoffMillis(5000).build(), controllerExecutorService);
    testState = new TestState(true);
    // read and write count variables
    streamManager = new StreamManagerImpl(clientConfig);
    createScopeAndStream(scope, STREAM_NAME, config, streamManager);
    log.info("Scope passed to client factory {}", scope);
    clientFactory = new ClientFactoryImpl(scope, controller, new SocketConnectionFactoryImpl(clientConfig));
    readerGroupManager = ReaderGroupManager.withScope(scope, clientConfig);
}
Also used : ClientFactoryImpl(io.pravega.client.stream.impl.ClientFactoryImpl) ControllerImpl(io.pravega.client.control.impl.ControllerImpl) Service(io.pravega.test.system.framework.services.Service) StreamManagerImpl(io.pravega.client.admin.impl.StreamManagerImpl) ClientConfig(io.pravega.client.ClientConfig) SocketConnectionFactoryImpl(io.pravega.client.connection.impl.SocketConnectionFactoryImpl) URI(java.net.URI) Before(org.junit.Before)

Example 13 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class PravegaControllerTest method controllerTest.

/**
 * Invoke the controller test.
 * The test fails in case controller is not running on given ports.
 */
@Test
public void controllerTest() {
    log.debug("Start execution of controllerTest");
    Service con = Utils.createPravegaControllerService(null);
    List<URI> conUri = con.getServiceDetails();
    log.debug("Controller Service URI details: {} ", conUri);
    assertTrue(conUri.stream().map(URI::getPort).allMatch(port -> {
        switch(Utils.EXECUTOR_TYPE) {
            case REMOTE_SEQUENTIAL:
                return port == PravegaControllerService.CONTROLLER_PORT || port == PravegaControllerService.REST_PORT;
            case DOCKER:
                return port == CONTROLLER_GRPC_PORT || port == REST_PORT;
            case KUBERNETES:
            default:
                return port == CONTROLLER_GRPC_PORT || port == CONTROLLER_REST_PORT;
        }
    }));
    log.debug("ControllerTest  execution completed");
}
Also used : Environment(io.pravega.test.system.framework.Environment) MarathonException(mesosphere.marathon.client.MarathonException) CONTROLLER_GRPC_PORT(io.pravega.test.system.framework.services.kubernetes.AbstractService.CONTROLLER_GRPC_PORT) RunWith(org.junit.runner.RunWith) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) PravegaControllerService(io.pravega.test.system.framework.services.marathon.PravegaControllerService) Service(io.pravega.test.system.framework.services.Service) CONTROLLER_REST_PORT(io.pravega.test.system.framework.services.kubernetes.AbstractService.CONTROLLER_REST_PORT) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) Rule(org.junit.Rule) Timeout(org.junit.rules.Timeout) URI(java.net.URI) Utils(io.pravega.test.system.framework.Utils) SystemTestRunner(io.pravega.test.system.framework.SystemTestRunner) REST_PORT(io.pravega.test.system.framework.Utils.REST_PORT) PravegaControllerService(io.pravega.test.system.framework.services.marathon.PravegaControllerService) Service(io.pravega.test.system.framework.services.Service) URI(java.net.URI) Test(org.junit.Test)

Example 14 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class OffsetTruncationTest method setup.

@Before
public void setup() {
    Service conService = Utils.createPravegaControllerService(null);
    List<URI> ctlURIs = conService.getServiceDetails();
    controllerURI = ctlURIs.get(0);
    streamManager = StreamManager.create(Utils.buildClientConfig(controllerURI));
    assertTrue("Creating scope", streamManager.createScope(SCOPE));
    assertTrue("Creating stream", streamManager.createStream(SCOPE, STREAM, config));
}
Also used : Service(io.pravega.test.system.framework.services.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) URI(java.net.URI) Before(org.junit.Before)

Example 15 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class PravegaSegmentStoreTest method initialize.

/**
 * This is used to setup the various services required by the system test framework.
 *
 * @throws MarathonException if error in setup
 */
@Environment
public static void initialize() throws MarathonException {
    Service zk = Utils.createZookeeperService();
    if (!zk.isRunning()) {
        zk.start(true);
    }
    Service bk = Utils.createBookkeeperService(zk.getServiceDetails().get(0));
    if (!bk.isRunning()) {
        bk.start(true);
    }
    Service con = Utils.createPravegaControllerService(zk.getServiceDetails().get(0));
    if (!con.isRunning()) {
        con.start(true);
    }
    Service seg = Utils.createPravegaSegmentStoreService(zk.getServiceDetails().get(0), con.getServiceDetails().get(0));
    if (!seg.isRunning()) {
        seg.start(true);
    }
}
Also used : Service(io.pravega.test.system.framework.services.Service) Environment(io.pravega.test.system.framework.Environment)

Aggregations

Service (io.pravega.test.system.framework.services.Service)48 URI (java.net.URI)41 Before (org.junit.Before)18 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)16 ControllerImpl (io.pravega.client.control.impl.ControllerImpl)12 Environment (io.pravega.test.system.framework.Environment)12 ClientConfig (io.pravega.client.ClientConfig)10 StreamManagerImpl (io.pravega.client.admin.impl.StreamManagerImpl)8 ClientFactoryImpl (io.pravega.client.stream.impl.ClientFactoryImpl)8 Test (org.junit.Test)8 ExecutionException (java.util.concurrent.ExecutionException)7 SocketConnectionFactoryImpl (io.pravega.client.connection.impl.SocketConnectionFactoryImpl)6 Cleanup (lombok.Cleanup)5 ReaderGroupManager (io.pravega.client.admin.ReaderGroupManager)3 PravegaControllerService (io.pravega.test.system.framework.services.marathon.PravegaControllerService)3 EventStreamClientFactory (io.pravega.client.EventStreamClientFactory)2 StreamManager (io.pravega.client.admin.StreamManager)2 ConnectionFactory (io.pravega.client.connection.impl.ConnectionFactory)2 ControllerImpl (io.pravega.client.stream.impl.ControllerImpl)2 Invocation (javax.ws.rs.client.Invocation)2