From: Sage Weil Date: Fri, 12 Jul 2013 02:06:47 +0000 (-0700) Subject: mon: add encoding tests for MonitorDBStore data types X-Git-Tag: v0.67-rc1~59^2~15^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=17c29957409f365a327c3b34e08c0e5de7d4e16a;p=ceph.git mon: add encoding tests for MonitorDBStore data types Signed-off-by: Sage Weil --- diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index 60a648de19b1..276620f75164 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -69,6 +69,19 @@ class MonitorDBStore ::decode(endkey, decode_bl); DECODE_FINISH(decode_bl); } + + void dump(Formatter *f) const { + f->dump_int("type", type); + f->dump_string("prefix", prefix); + f->dump_string("key", key); + if (endkey.length()) + f->dump_string("endkey", endkey); + } + + static void generate_test_instances(list& ls) { + ls.push_back(new Op); + // we get coverage here from the Transaction instances + } }; struct Transaction { @@ -126,6 +139,17 @@ class MonitorDBStore DECODE_FINISH(bl); } + static void generate_test_instances(list& ls) { + ls.push_back(new Transaction); + ls.push_back(new Transaction); + bufferlist bl; + bl.append("value"); + ls.back()->put("prefix", "key", bl); + ls.back()->erase("prefix2", "key2"); + ls.back()->compact_prefix("prefix3"); + ls.back()->compact_range("prefix4", "from", "to"); + } + void append(Transaction& other) { ops.splice(ops.end(), other.ops); } diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index 142f732ab164..7c927dc9734c 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -79,6 +79,10 @@ TYPE(AuthMonitor::Incremental) TYPE(PGMap::Incremental) TYPE(PGMap) +#include "mon/MonitorDBStore.h" +TYPE(MonitorDBStore::Transaction) +TYPE(MonitorDBStore::Op) + #include "mon/MonMap.h" TYPE_FEATUREFUL(MonMap)