Closed daschl closed 5 years ago
When a counter underflow is triggered, the real server responds with SUBDOC_DELTA_RANGE while the mock responds with SUBDOC_VALUE_CANTINSERT.
SUBDOC_DELTA_RANGE
SUBDOC_VALUE_CANTINSERT
Here is the test case from core-io that triggers it:
@Test public void shouldReturnDeltaRangeOnCounterDeltaUnderflow() { String path = "counter"; long prepareUnderflow = -1L; long delta = Long.MIN_VALUE; //first request will bring the value to -1 SubCounterRequest request = new SubCounterRequest(testSubKey, path, prepareUnderflow, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); String result = response.content().toString(CharsetUtil.UTF_8); assertEquals("-1", result); //second request will underflow request = new SubCounterRequest(testSubKey, path, delta, bucket()); response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); result = response.content().toString(CharsetUtil.UTF_8); assertEquals(result, 0, result.length()); assertEquals(ResponseStatus.SUBDOC_DELTA_RANGE, response.status()); }
Fixed in http://review.couchbase.org/c/101590/
When a counter underflow is triggered, the real server responds with
SUBDOC_DELTA_RANGE
while the mock responds withSUBDOC_VALUE_CANTINSERT
.Here is the test case from core-io that triggers it: