[SCM] CTDB repository - branch master updated - ctdb-1.12-204-gd3c54ae
Ronnie Sahlberg
sahlberg at samba.org
Sun Feb 19 15:56:41 MST 2012
The branch, master has been updated
via d3c54ae9cc83f74d15f40bbfff95404b270d2f80 (commit)
via 4ea05fef886b0680d0ad0936c239a51fd75bf000 (commit)
from 650bb17335876f3e91e76a47b748c9236d0f3045 (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d3c54ae9cc83f74d15f40bbfff95404b270d2f80
Merge: 4ea05fef886b0680d0ad0936c239a51fd75bf000 650bb17335876f3e91e76a47b748c9236d0f3045
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Feb 20 09:54:52 2012 +1100
Merge branch 'master' of ssh://git.samba.org/data/git/ctdb
commit 4ea05fef886b0680d0ad0936c239a51fd75bf000
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Feb 16 10:19:15 2012 +1100
TESTS: Add test for wipedb command
-----------------------------------------------------------------------
Summary of changes:
tests/simple/71_ctdb_wipedb.sh | 68 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
create mode 100755 tests/simple/71_ctdb_wipedb.sh
Changeset truncated at 500 lines:
diff --git a/tests/simple/71_ctdb_wipedb.sh b/tests/simple/71_ctdb_wipedb.sh
new file mode 100755
index 0000000..3859661
--- /dev/null
+++ b/tests/simple/71_ctdb_wipedb.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+test_info()
+{
+ cat <<EOF
+The command 'ctdb wipedb' is used to clear a database across the whole
+cluster.
+
+Prerequisites:
+
+* An active CTDB cluster with at least 2 active nodes.
+
+Steps:
+
+1. Verify that the status on all of the ctdb nodes is 'OK'.
+2. create a persistent test database
+3, add some records to node #0 and node #1
+4, perform wipedb on node #0 and verify the database is empty on both node 0 and 1
+
+Expected results:
+
+* that 4 will result in empty database
+
+EOF
+}
+
+. ctdb_test_functions.bash
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+try_command_on_node 0 "$CTDB listnodes"
+num_nodes=$(echo "$out" | wc -l)
+
+# create a temporary persistent database to test with
+echo create persistent test database persistent_test.tdb
+try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb attach persistent_test.tdb persistent
+
+
+# 3,
+# add one record to node 0 key==ABC data==ABC
+TDB=`try_command_on_node -v -q 0 $CTDB_TEST_WRAPPER ctdb getdbmap | grep persistent_test.tdb | sed -e "s/.*path://" -e "s/ .*//"`
+echo "store key(ABC) data(ABC) on node 0"
+try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb tstore $TDB 0x414243 0x070000000000000000000000000000000000000000000000414243
+#
+# add one record to node 1 key==DEF data==DEF
+TDB=`try_command_on_node -v -q 1 $CTDB_TEST_WRAPPER ctdb getdbmap | grep persistent_test.tdb | sed -e "s/.*path://" -e "s/ .*//"`
+echo "store key(DEF) data(DEF) on node 1"
+try_command_on_node -q 1 $CTDB_TEST_WRAPPER ctdb tstore $TDB 0x444546 0x070000000000000000000000000000000000000000000000444546
+
+
+# 4,
+echo wipe the persistent test database
+try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb wipedb persistent_test.tdb
+echo force a recovery
+try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb recover
+
+# check that the database is wiped
+num_records=$(try_command_on_node -v -pq 1 $CTDB_TEST_WRAPPER ctdb cattdb persistent_test.tdb | grep key | wc -l)
+[ $num_records != "0" ] && {
+ echo "BAD: we did not end up with an empty database"
+ exit 1
+}
+echo "OK. database was wiped"
+
--
CTDB repository
More information about the samba-cvs
mailing list