benchmark: add auth check in benchmark

When we run benchmark but forget to set the right requirepass, benchmark should return error.
This commit is contained in:
vattezhang 2019-02-18 22:48:55 +08:00
parent e6948b8f28
commit 4cc43a96f6

View File

@ -204,6 +204,12 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
if (redisBufferRead(c->context) != REDIS_OK) {
fprintf(stderr,"Error: %s\n",c->context->errstr);
exit(1);
}
else if (strlen(c->context->reader->buf)>=32
&& !strncmp(c->context->reader->buf,"-NOAUTH Authentication required.", 32))
{
fprintf(stderr,"Error: %s\n",c->context->reader->buf);
exit(1);
} else {
while(c->pending) {
if (redisGetReply(c->context,&reply) != REDIS_OK) {