Fix Pipeline NPE or sth with multi
* followings are now throwing JedisDataException: it was uncontrolled or controlled by Redis itself ** exec without multi ** discard without multi ** multi within multi * updates unit test actually Redis returns ERR and we can pick, but Pipeline + multi has some complex sequence so it can just throw NPE without ERR
This commit is contained in:
@@ -272,6 +272,26 @@ public class PipeliningTest extends Assert {
|
||||
assertEquals("world", r3.get());
|
||||
}
|
||||
|
||||
@Test(expected = JedisDataException.class)
|
||||
public void pipelineExecShoudThrowJedisDataExceptionWhenNotInMulti() {
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
pipeline.exec();
|
||||
}
|
||||
|
||||
@Test(expected = JedisDataException.class)
|
||||
public void pipelineDiscardShoudThrowJedisDataExceptionWhenNotInMulti() {
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
pipeline.discard();
|
||||
}
|
||||
|
||||
@Test(expected = JedisDataException.class)
|
||||
public void pipelineMultiShoudThrowJedisDataExceptionWhenAlreadyInMulti() {
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
pipeline.multi();
|
||||
pipeline.set("foo", "3");
|
||||
pipeline.multi();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiscardInPipeline() {
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
|
||||
Reference in New Issue
Block a user