You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2014/03/15 00:17:09 UTC

[2/5] git commit: Added tests for InMemoryStorage.

Added tests for InMemoryStorage.

Review: https://reviews.apache.org/r/19072


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/90a7c501
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/90a7c501
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/90a7c501

Branch: refs/heads/master
Commit: 90a7c50118c6b021ec3a8cfb4c0e7a762f6d6cc2
Parents: 0d65a3c
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Tue Mar 11 15:33:28 2014 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Fri Mar 14 15:32:15 2014 -0700

----------------------------------------------------------------------
 src/tests/state_tests.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/90a7c501/src/tests/state_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/state_tests.cpp b/src/tests/state_tests.cpp
index bc6c914..d0e0840 100644
--- a/src/tests/state_tests.cpp
+++ b/src/tests/state_tests.cpp
@@ -37,6 +37,7 @@
 
 #include "master/registry.hpp"
 
+#include "state/in_memory.hpp"
 #include "state/leveldb.hpp"
 #include "state/protobuf.hpp"
 #include "state/storage.hpp"
@@ -303,6 +304,73 @@ void Names(State* state)
 }
 
 
+class InMemoryStateTest : public ::testing::Test
+{
+public:
+  InMemoryStateTest()
+    : storage(NULL),
+      state(NULL) {}
+
+protected:
+  virtual void SetUp()
+  {
+    storage = new state::InMemoryStorage();
+    state = new State(storage);
+  }
+
+  virtual void TearDown()
+  {
+    delete state;
+    delete storage;
+  }
+
+  state::Storage* storage;
+  State* state;
+};
+
+
+TEST_F(InMemoryStateTest, FetchAndStoreAndFetch)
+{
+  FetchAndStoreAndFetch(state);
+}
+
+
+TEST_F(InMemoryStateTest, FetchAndStoreAndStoreAndFetch)
+{
+  FetchAndStoreAndStoreAndFetch(state);
+}
+
+
+TEST_F(InMemoryStateTest, FetchAndStoreAndStoreFailAndFetch)
+{
+  FetchAndStoreAndStoreFailAndFetch(state);
+}
+
+
+TEST_F(InMemoryStateTest, FetchAndStoreAndExpungeAndFetch)
+{
+  FetchAndStoreAndExpungeAndFetch(state);
+}
+
+
+TEST_F(InMemoryStateTest, FetchAndStoreAndExpungeAndExpunge)
+{
+  FetchAndStoreAndExpungeAndExpunge(state);
+}
+
+
+TEST_F(InMemoryStateTest, FetchAndStoreAndExpungeAndStoreAndFetch)
+{
+  FetchAndStoreAndExpungeAndStoreAndFetch(state);
+}
+
+
+TEST_F(InMemoryStateTest, Names)
+{
+  Names(state);
+}
+
+
 class LevelDBStateTest : public ::testing::Test
 {
 public: