var db = require("org/arangodb").db; var internal = require("internal"); var jsunity = require("jsunity"); function runSetup () { internal.debugClearFailAt(); db._drop("UnitTestsRecovery"); var c = db._create("UnitTestsRecovery"); c.save({ _key: "crashme", thefoxx: "is quick and jumped over the lazy dog" }, true); // wait for sync internal.debugSegfault("crashing server"); } //////////////////////////////////////////////////////////////////////////////// /// @brief test suite //////////////////////////////////////////////////////////////////////////////// function recoverySuite () { jsunity.jsUnity.attachAssertions(); return { setUp: function () { }, tearDown: function () { }, //////////////////////////////////////////////////////////////////////////////// /// @brief test whether we can restore the trx data //////////////////////////////////////////////////////////////////////////////// testWaitForSync : function () { var c = db._collection("UnitTestsRecovery"); assertEqual("is quick and jumped over the lazy dog", c.document("crashme").thefoxx); } }; } //////////////////////////////////////////////////////////////////////////////// /// @brief executes the test suite //////////////////////////////////////////////////////////////////////////////// function main (argv) { if (argv[1] === "setup") { runSetup(); return 0; } else { jsunity.run(recoverySuite); return jsunity.done() ? 0 : 1; } }