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);
}
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);
}
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");
}
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));
}
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);
}
}
Aggregations