Search in sources :

Example 6 with LockResponse

use of io.etcd.jetcd.lock.LockResponse in project jetcd by coreos.

the class LockTest method testLockWithNotExistingLease.

@ParameterizedTest
@MethodSource("parameters")
public void testLockWithNotExistingLease(boolean useNamespace) {
    Throwable exception = assertThrows(ExecutionException.class, () -> {
        initializeLockCLient(useNamespace);
        CompletableFuture<LockResponse> feature = lockClient.lock(SAMPLE_NAME, 123456);
        LockResponse response = feature.get();
        locksToRelease.add(response.getKey());
    });
    assertThat(exception.getMessage().contains("etcdserver: requested lease not found")).isTrue();
}
Also used : LockResponse(io.etcd.jetcd.lock.LockResponse) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

LockResponse (io.etcd.jetcd.lock.LockResponse)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 MethodSource (org.junit.jupiter.params.provider.MethodSource)4 ByteSequence (io.etcd.jetcd.ByteSequence)1 Client (io.etcd.jetcd.Client)1 Lock (io.etcd.jetcd.Lock)1 LockRequest (io.etcd.jetcd.api.lock.LockRequest)1 Errors (io.etcd.jetcd.support.Errors)1 Test (org.junit.jupiter.api.Test)1