ctdb-tests: Drop CTDB_TEST_MAX_NODES
authorMartin Schwenke <martin@meltin.net>
Wed, 22 Jun 2016 01:02:36 +0000 (11:02 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 4 Jul 2016 13:42:24 +0000 (15:42 +0200)
The node map is dynamically constructed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/src/ctdb_takeover_tests.c

index 583dac9..a46ddbc 100644 (file)
@@ -21,9 +21,6 @@
 
 #include "ctdbd_test.c"
 
-/* This is lazy... but it is test code! */
-#define CTDB_TEST_MAX_NODES 256
-
 static void print_ctdb_public_ip_list(struct public_ip_list * ips)
 {
        while (ips) {
@@ -129,10 +126,10 @@ static void read_ctdb_public_ip_info(TALLOC_CTX *ctx,
        enum ctdb_runstate *runstate;
 
        *known = talloc_zero_array(ctx, struct ctdb_public_ip_list,
-                                  CTDB_TEST_MAX_NODES);
+                                  numnodes);
        assert(*known != NULL);
        *avail = talloc_zero_array(ctx, struct ctdb_public_ip_list,
-                                  CTDB_TEST_MAX_NODES);
+                                  numnodes);
        assert(*avail != NULL);
 
        if (multi) {
@@ -266,10 +263,6 @@ static void ctdb_test_init(const char nodestates[],
                nodemap->nodes[n].flags = (uint32_t) strtol(tok, NULL, 0);
                nodemap->nodes[n].addr = sa_zero;
                nodemap->num++;
-               if (nodemap->num >= CTDB_TEST_MAX_NODES) {
-                       DEBUG(DEBUG_ERR, ("ERROR: Exceeding CTDB_TEST_MAX_NODES: %d\n", CTDB_TEST_MAX_NODES));
-                       exit(1);
-               }
                tok = strtok(NULL, ",");
        }