Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class ClientKillParams extends Params {
private static final String TYPE = "TYPE";
private static final String ADDR = "ADDR";
private static final String SKIPME = "SKIPME";
private static final String USER = "USER";

public static enum Type {
NORMAL, MASTER, SLAVE, PUBSUB;
Expand Down Expand Up @@ -57,4 +58,9 @@ public ClientKillParams skipMe(SkipMe skipMe) {
return this;
}

public ClientKillParams user(String username) {
addParam(USER, username);
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ public void killAddrIpPort() {
assertDisconnected(client);
}

@Test
public void killUser() {
Jedis client2 = new Jedis(hnp.getHost(), hnp.getPort(), 500);
client.aclSetUser("test_kill", "on", "+acl", ">password1");
client2.auth("test_kill", "password1");
long clients = jedis.clientKill(new ClientKillParams().user("test_kill"));
assertEquals(1, clients);
assertDisconnected(client2);
jedis.aclDelUser("test_kill");
}

private void assertDisconnected(Jedis j) {
try {
j.ping();
Expand Down