Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Koksharov committed May 20, 2024
1 parent 54a3a09 commit 3d71685
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions redisson/src/test/java/org/redisson/RedissonBatchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.redisson.api.*;
import org.redisson.api.BatchOptions.ExecutionMode;
import org.redisson.client.RedisClient;
import org.redisson.client.RedisClientConfig;
import org.redisson.client.RedisConnection;
import org.redisson.client.*;
import org.redisson.client.codec.StringCodec;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.cluster.ClusterNodeInfo;
Expand Down Expand Up @@ -273,6 +271,29 @@ public void testSkipResult() throws InterruptedException, ExecutionException, Ti
}
}

@ParameterizedTest
@MethodSource("data")
public void testConnectionLeakAfterError(BatchOptions batchOptions) {
Config config = createConfig();
config.useSingleServer()
.setConnectionMinimumIdleSize(1).setConnectionPoolSize(1);

RedissonClient redisson = Redisson.create(config);
redisson.getBucket("test").set("test");

for (int i = 0; i < 5; i++) {
try {
RBatch batch = redisson.createBatch(batchOptions);
batch.getAtomicLong("test").incrementAndGetAsync();
batch.execute();
} catch (RedisTimeoutException e) {
org.junit.jupiter.api.Assertions.fail(e);
} catch (RedisException e) {
// skip
}
}
}

@Test
public void testConnectionLeakAfterError() throws InterruptedException {
Config config = createConfig();
Expand Down

0 comments on commit 3d71685

Please sign in to comment.