Exists operation returns false even when operation should fail with exception

I’m using CouchbaseMock 1.5.22 for my testing and couchbase-client 2.7.2.

My test looks the following way:

@Test(expected = TemporaryFailureException.class)
public void test() {
    mockHttpClient.request(new OpfailRequest(ErrorCode.EBUSY, 10), "Fail");

// operation being tested
    public Observable<Boolean> exists(String key) {
    return asyncBucket
            .compose(logAndTimeoutAndRetry(key, "exists"))

I expect exists to fail with TemporaryFailureException, but that does not happen – instead I get false as result. When debugging couchbase client I see the following response from server:


Looks like Exists.java does not check response.status() as it is done in Get.java. Check the following code: https://github.com/couchbase/couchbase-java-client/blob/master/src/main/java/com/couchbase/client/java/bucket/api/Get.java#L152

Looks like this is a bug according to exists operation javadoc.

1 Like

Hi @Aloren,

Yes, it looks to be a bug that it is returning false instead of TemporaryFailureException.