diff options
author | Martin Schwenke <martin@meltin.net> | 2020-05-04 16:58:38 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2020-05-22 06:41:45 +0000 |
commit | fb38252677d0dab299f3fab051eb031167b87242 (patch) | |
tree | c2d64664986a57ce8c4df36cdcbf0bf72bd4d5a6 /ctdb/tests | |
parent | 53b73b9b0f99c9683fca043f4fee74be6a488c66 (diff) | |
download | samba-fb38252677d0dab299f3fab051eb031167b87242.tar.gz |
ctdb-tests: Update fetch_ring to take database and key on command line
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-x | ctdb/tests/INTEGRATION/database/fetch.001.ring.sh | 3 | ||||
-rw-r--r-- | ctdb/tests/src/fetch_ring.c | 30 |
2 files changed, 21 insertions, 12 deletions
diff --git a/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh b/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh index 05632024cb5..33df07b7d88 100755 --- a/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh +++ b/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh @@ -23,7 +23,8 @@ try_command_on_node 0 "$CTDB listnodes | wc -l" num_nodes="$out" echo "Running fetch_ring on all $num_nodes nodes." -try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND fetch_ring -n $num_nodes +testprog_onnode -v -p all \ + fetch_ring -n "$num_nodes" -D "fetch_ring.tdb" -k "testkey" pat='^(Waiting for cluster|Fetch\[[[:digit:]]+\]: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec)$' sanity_check_output 1 "$pat" diff --git a/ctdb/tests/src/fetch_ring.c b/ctdb/tests/src/fetch_ring.c index a8d103ed3f2..f1786ef370b 100644 --- a/ctdb/tests/src/fetch_ring.c +++ b/ctdb/tests/src/fetch_ring.c @@ -28,9 +28,6 @@ #include "tests/src/test_options.h" #include "tests/src/cluster_wait.h" -#define TESTDB "fetch_ring.tdb" -#define TESTKEY "testkey" - #define MSG_ID_FETCH 0 static uint32_t next_node(struct ctdb_client_context *client, uint32_t num_nodes) @@ -63,7 +60,9 @@ static struct tevent_req *fetch_ring_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct ctdb_client_context *client, struct ctdb_db_context *ctdb_db, - uint32_t num_nodes, int timelimit, + const char *keystr, + uint32_t num_nodes, + int timelimit, int interactive) { struct tevent_req *req, *subreq; @@ -80,8 +79,8 @@ static struct tevent_req *fetch_ring_send(TALLOC_CTX *mem_ctx, state->num_nodes = num_nodes; state->timelimit = timelimit; state->interactive = interactive; - state->key.dptr = discard_const(TESTKEY); - state->key.dsize = strlen(TESTKEY); + state->key.dptr = discard_const(keystr); + state->key.dsize = strlen(keystr); subreq = ctdb_client_set_message_handler_send( state, ev, client, MSG_ID_FETCH, @@ -334,7 +333,7 @@ int main(int argc, const char *argv[]) setup_logging("fetch_ring", DEBUG_STDERR); - status = process_options_basic(argc, argv, &opts); + status = process_options_database(argc, argv, &opts); if (! status) { exit(1); } @@ -362,15 +361,24 @@ int main(int argc, const char *argv[]) exit(1); } - ret = ctdb_attach(ev, client, tevent_timeval_zero(), TESTDB, 0, + ret = ctdb_attach(ev, + client, + tevent_timeval_zero(), + opts->dbname, + 0, &ctdb_db); if (ret != 0) { - fprintf(stderr, "Failed to attach to DB %s\n", TESTDB); + fprintf(stderr, "Failed to attach to DB %s\n", opts->dbname); exit(1); } - req = fetch_ring_send(mem_ctx, ev, client, ctdb_db, - opts->num_nodes, opts->timelimit, + req = fetch_ring_send(mem_ctx, + ev, + client, + ctdb_db, + opts->keystr, + opts->num_nodes, + opts->timelimit, opts->interactive); if (req == NULL) { fprintf(stderr, "Memory allocation error\n"); |