use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class DefaultConfigurationProviderIntegrationTest method retriesOnBucketNotFoundDuringLoadException.
/**
* Need to make sure that if a bucket is not found during load, we continue retrying the open
* bucket attempts.
*/
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void retriesOnBucketNotFoundDuringLoadException() {
TestNodeConfig cfg = config().firstNodeWith(Services.KV).get();
Set<SeedNode> seeds = new HashSet<>(Collections.singletonList(SeedNode.create(cfg.hostname(), Optional.of(cfg.ports().get(Services.KV)), Optional.of(cfg.ports().get(Services.MANAGER)))));
SimpleEventBus eventBus = new SimpleEventBus(true);
environment = CoreEnvironment.builder().eventBus(eventBus).build();
core = Core.create(environment, authenticator(), seeds);
ConfigurationProvider provider = new DefaultConfigurationProvider(core, seeds);
try {
String bucketName = "this-bucket-does-not-exist";
provider.openBucket(bucketName).subscribe(v -> {
}, e -> assertTrue(e instanceof ConfigException));
waitUntilCondition(() -> eventBus.publishedEvents().stream().anyMatch(p -> p instanceof BucketOpenRetriedEvent));
for (Event event : eventBus.publishedEvents()) {
if (event instanceof BucketOpenRetriedEvent) {
assertEquals(bucketName, ((BucketOpenRetriedEvent) event).bucketName());
assertTrue(event.cause() instanceof BucketNotFoundDuringLoadException);
}
}
} finally {
provider.shutdown().block();
}
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class ClusterManagerBucketRefresherIntegrationTest method streamsNewConfigurations.
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void streamsNewConfigurations() {
Core core = Core.create(env, authenticator(), seedNodes());
ProposedBucketConfigInspectingProvider inspectingProvider = new ProposedBucketConfigInspectingProvider(core.configurationProvider());
ClusterManagerBucketRefresher refresher = new ClusterManagerBucketRefresher(inspectingProvider, core);
core.openBucket(config().bucketname());
waitUntilCondition(() -> core.clusterConfig().hasClusterOrBucketConfig());
refresher.register(config().bucketname()).block();
waitUntilCondition(() -> !inspectingProvider.proposedConfigs().isEmpty());
ProposedBucketConfigContext proposed = inspectingProvider.proposedConfigs().get(0).proposedConfig();
assertEquals(config().bucketname(), proposed.bucketName());
assertNotNull(proposed.config());
refresher.shutdown().block();
core.shutdown().block();
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class KeyValueIntegrationTest method failFastIfSyncReplicationNotAvailable.
@Test
@IgnoreWhen(hasCapabilities = { Capabilities.SYNC_REPLICATION })
void failFastIfSyncReplicationNotAvailable() {
String id = UUID.randomUUID().toString();
byte[] content = "hello, world".getBytes(UTF_8);
InsertRequest insertRequest = new InsertRequest(id, content, 0, 0, kvTimeout, core.context(), CollectionIdentifier.fromDefault(config().bucketname()), env.retryStrategy(), Optional.of(DurabilityLevel.MAJORITY), null);
core.send(insertRequest);
ExecutionException exception = assertThrows(ExecutionException.class, () -> insertRequest.response().get());
assertTrue(exception.getCause() instanceof FeatureNotAvailableException);
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class RateLimitingIntegrationTest method queryRateLimitConcurrentRequests.
@Test
@IgnoreWhen(missesCapabilities = Capabilities.QUERY)
void queryRateLimitConcurrentRequests() throws Exception {
String username = "queryRateLimitConcurrentRequests";
Limits limits = new Limits();
limits.queryLimits = new QueryLimits(1, 100, 10, 10);
createRateLimitedUser(username, limits);
Cluster cluster = createTestCluster(username);
try {
cluster.waitUntilReady(Duration.ofSeconds(10));
RateLimitedException ex = assertThrows(RateLimitedException.class, () -> Flux.range(0, 50).flatMap(i -> cluster.reactive().query("select 1=1")).blockLast());
assertTrue(ex.getMessage().contains("User has more requests running than allowed"));
} finally {
cluster.disconnect();
adminCluster.users().dropUser(username);
}
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class RateLimitingIntegrationTest method searchRateLimitMaxIngress.
@Test
@IgnoreWhen(missesCapabilities = Capabilities.SEARCH)
void searchRateLimitMaxIngress() throws Exception {
String username = "searchRateLimitIngress";
Limits limits = new Limits();
limits.searchLimits = new SearchLimits(10, 100, 1, 10);
createRateLimitedUser(username, limits);
adminCluster.searchIndexes().upsertIndex(new SearchIndex("ratelimits-ingress", config().bucketname()));
Cluster cluster = createTestCluster(username);
try {
cluster.waitUntilReady(Duration.ofSeconds(10));
String content = repeatString(1024 * 1024, "a");
RateLimitedException ex = assertThrows(RateLimitedException.class, () -> {
for (int i = 0; i < 10; i++) {
try {
SearchResult res = cluster.searchQuery("ratelimits-ingress", QueryStringQuery.match(content), SearchOptions.searchOptions().timeout(Duration.ofSeconds(10)).limit(1));
} catch (TimeoutException e) {
// continue
} catch (CouchbaseException e) {
if (e.getMessage().contains("no planPIndexes")) {
continue;
}
throw e;
}
}
});
assertTrue(ex.getMessage().contains("ingress_mib_per_min"));
} finally {
cluster.disconnect();
adminCluster.users().dropUser(username);
adminCluster.searchIndexes().dropIndex("ratelimits-ingress");
}
}
Aggregations