summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2017-03-02 18:14:44 +1100
committerMartin Schwenke <martins@samba.org>2017-06-29 10:34:28 +0200
commita388fe15231da71b256844180f46d64d990a5ab6 (patch)
treedf2dc0afacb277f2e81d057bc18f2849957b1409 /ctdb
parentd74eb9577d0af17cf11fc6cbf5893bf076d8871b (diff)
downloadsamba-a388fe15231da71b256844180f46d64d990a5ab6.tar.gz
ctdb-tests: Add database type option for tests
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/src/test_options.c9
-rw-r--r--ctdb/tests/src/test_options.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/ctdb/tests/src/test_options.c b/ctdb/tests/src/test_options.c
index 847ec95766c..e732a79c8ff 100644
--- a/ctdb/tests/src/test_options.c
+++ b/ctdb/tests/src/test_options.c
@@ -55,6 +55,8 @@ static struct poptOption options_database[] = {
"Name of database key" },
{ "value", 'v', POPT_ARG_STRING, &_values.valuestr, 0,
"Value of database key" },
+ { "dbtype", 'T', POPT_ARG_STRING, &_values.dbtype, 0,
+ "CTDB database type" },
{ NULL }
};
@@ -84,6 +86,7 @@ static void set_defaults_database(struct test_options *opts)
opts->dbname = NULL;
opts->keystr = NULL;
opts->valuestr = NULL;
+ opts->dbtype = "volatile";
}
static bool verify_options_basic(struct test_options *opts)
@@ -114,6 +117,12 @@ static bool verify_options_database(struct test_options *opts)
return false;
}
+ if ((strcmp(opts->dbtype, "volatile") != 0) &&
+ (strcmp(opts->dbtype, "persistent") != 0) &&
+ (strcmp(opts->dbtype, "replicated") != 0)) {
+ return false;
+ }
+
return true;
}
diff --git a/ctdb/tests/src/test_options.h b/ctdb/tests/src/test_options.h
index 4874dd2aded..1e194c9e436 100644
--- a/ctdb/tests/src/test_options.h
+++ b/ctdb/tests/src/test_options.h
@@ -32,6 +32,7 @@ struct test_options {
const char *dbname;
const char *keystr;
const char *valuestr;
+ const char *dbtype;
};
bool process_options_basic(int argc, const char **argv,