Skip to content

Commit

Permalink
fixup: handle review comments and other findings.
Browse files Browse the repository at this point in the history
Let connect error logs be printed to stdout since this step is part
of the testcase.
  • Loading branch information
bjosv committed Sep 1, 2023
1 parent 62e76e5 commit 510162c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions tests/clusterclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ void eventCallback(const redisClusterContext *cc, int event, void *privdata) {
}

int main(int argc, char **argv) {
int use_cluster_slots = 1;
int show_events = 0;
int use_cluster_slots = 1;
int send_to_all = 0;

int argindex;
for (argindex = 1; argindex < argc && argv[argindex][0] == '-';
argindex++) {
if (strcmp(argv[argindex], "--use-cluster-nodes") == 0) {
use_cluster_slots = 0;
} else if (strcmp(argv[argindex], "--events") == 0) {
if (strcmp(argv[argindex], "--events") == 0) {
show_events = 1;
} else if (strcmp(argv[argindex], "--use-cluster-nodes") == 0) {
use_cluster_slots = 0;
} else {
fprintf(stderr, "Unknown argument: '%s'\n", argv[argindex]);
}
}

if (argindex >= argc) {
fprintf(stderr, "Usage: clusterclient [--events] HOST:PORT\n");
fprintf(stderr, "Usage: clusterclient [--events] [--use-cluster-nodes] HOST:PORT\n");
exit(1);
}
const char *initnode = argv[argindex];
Expand All @@ -89,8 +89,8 @@ int main(int argc, char **argv) {
}

if (redisClusterConnect2(cc) != REDIS_OK) {
fprintf(stderr, "Connect error: %s\n", cc->errstr);
exit(2);
printf("Connect error: %s\n", cc->errstr);
exit(1);
}

char command[256];
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/connect-error-using-cluster-nodes-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ server=$!
wait $syncpid;

# Run client and use CLUSTER NODES to get topology
timeout 3s "$clientprog" --use-cluster-nodes 127.0.0.1:7400 > "$testname.out" 2>&1
timeout 3s "$clientprog" --use-cluster-nodes 127.0.0.1:7400 > "$testname.out"
clientexit=$?

# Wait for server to exit
Expand All @@ -44,7 +44,7 @@ if [ $serverexit -ne 0 ]; then
fi

# Check exit status on client, which SHOULD fail.
if [ $clientexit -ne 2 ]; then
if [ $clientexit -ne 1 ]; then
echo "$clientprog exited with status $clientexit"
exit $clientexit
fi
Expand Down

0 comments on commit 510162c

Please sign in to comment.