use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class QueryErrorIntegrationTest method includesHttpStatusCodeInErrorContext.
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void includesHttpStatusCodeInErrorContext() {
ParsingFailureException ex = assertThrows(ParsingFailureException.class, () -> cluster.query("select 1="));
assertTrue(ex.getMessage().contains("\"httpStatus\":400"));
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class CollectionManagerErrorIntegrationTest method failsUnderMemcachedBuckets.
@Test
@IgnoreWhen(missesCapabilities = Capabilities.COLLECTIONS)
void failsUnderMemcachedBuckets() {
String bucketName = UUID.randomUUID().toString();
cluster.buckets().createBucket(BucketSettings.create(bucketName).bucketType(BucketType.MEMCACHED));
try {
Bucket bucket = cluster.bucket(bucketName);
bucket.waitUntilReady(Duration.ofSeconds(10));
CollectionManager mgr = bucket.collections();
assertThrows(FeatureNotAvailableException.class, () -> mgr.createScope("a"));
assertThrows(FeatureNotAvailableException.class, () -> mgr.createCollection(CollectionSpec.create("a", "b")));
assertThrows(FeatureNotAvailableException.class, () -> mgr.dropScope("a"));
assertThrows(FeatureNotAvailableException.class, () -> mgr.dropCollection(CollectionSpec.create("a", "b")));
} finally {
cluster.buckets().dropBucket(bucketName);
}
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SubdocMutateIntegrationTest method counterMinusCreatePath.
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void counterMinusCreatePath() {
JsonObject updatedContent = checkSingleOpSuccess(JsonObject.create(), Arrays.asList(MutateInSpec.decrement("foo", 3).createPath()));
assertEquals(-3, (int) updatedContent.getInt("foo"));
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class WaitUntilReadyIntegrationTest method handlesCreatingBucketDuringWaitUntilReady.
@Test
@IgnoreWhen(clusterTypes = { ClusterType.MOCKED, ClusterType.CAVES })
void handlesCreatingBucketDuringWaitUntilReady() {
ExecutorService es = Executors.newFixedThreadPool(1);
String bucketName = UUID.randomUUID().toString();
if (!config().capabilities().contains(Capabilities.GLOBAL_CONFIG)) {
// We need to open the "other" bucket to make sure the test passes in clusters pre 6.5
Bucket b = cluster.bucket(config().bucketname());
b.waitUntilReady(Duration.ofSeconds(30));
}
long creationDelay = 2000;
try {
Bucket bucket = cluster.bucket(bucketName);
es.submit(() -> {
try {
Thread.sleep(creationDelay);
} catch (InterruptedException e) {
fail();
}
cluster.buckets().createBucket(BucketSettings.create(bucketName));
});
long start = System.nanoTime();
bucket.waitUntilReady(Duration.ofSeconds(30));
long end = System.nanoTime();
Collection collection = bucket.defaultCollection();
collection.upsert("my-doc", JsonObject.create());
assertEquals(JsonObject.create(), collection.get("my-doc").contentAsObject());
assertTrue(TimeUnit.NANOSECONDS.toMillis(end - start) > creationDelay);
} finally {
es.shutdownNow();
try {
cluster.buckets().dropBucket(bucketName);
} catch (BucketNotFoundException ex) {
// ignore
}
}
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class AnalyticsErrorIntegrationTest method includesHttpStatusCodeInErrorContext.
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void includesHttpStatusCodeInErrorContext() {
ParsingFailureException ex = assertThrows(ParsingFailureException.class, () -> cluster.analyticsQuery("select 1="));
assertTrue(ex.getMessage().contains("\"httpStatus\":400"));
}
Aggregations