Skip to content

Commit

Permalink
Merge pull request redis#6051 from vattezhang/unstable
Browse files Browse the repository at this point in the history
 fix: benchmark auth fails when server have requirepass
  • Loading branch information
antirez authored May 2, 2019
2 parents 843de8b + 4e38ced commit 0a6090b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/redis-benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,19 @@ static redisConfig *getRedisConfig(const char *ip, int port,
else fprintf(stderr,"%s: %s\n",hostsocket,err);
goto fail;
}

if(config.auth){
void *authReply = NULL;
redisAppendCommand(c, "AUTH %s", config.auth);
if (REDIS_OK != redisGetReply(c, &authReply)) goto fail;
if (reply) freeReplyObject(reply);
reply = ((redisReply *) authReply);
if (reply->type == REDIS_REPLY_ERROR) {
fprintf(stderr, "ERROR: %s\n", reply->str);
goto fail;
}
}

redisAppendCommand(c, "CONFIG GET %s", "save");
redisAppendCommand(c, "CONFIG GET %s", "appendonly");
int i = 0;
Expand Down

0 comments on commit 0a6090b

Please sign in to comment.