add print in testmongodb

This commit is contained in:
Cloud Wu
2017-04-20 18:52:02 +08:00
parent 77ed1bd68b
commit 89d771929a

View File

@@ -7,18 +7,10 @@ local host, db_name = ...
function test_insert_without_index()
local db = mongo.client({host = host})
local r = db:runCommand("buildInfo",1)
for k, v in pairs(r) do
print(k,v)
end
db[db_name].testdb:dropIndex("*")
db[db_name].testdb:drop()
local ret = db[db_name].testdb:safe_insert({test_key = 1});
for k,v in pairs(ret) do
print(k,v)
end
assert(ret and ret.n == 1)
local ret = db[db_name].testdb:safe_insert({test_key = 1});
@@ -92,7 +84,7 @@ function test_expire_index()
assert(ret and ret.test_key == 1)
for i = 1, 1000 do
skynet.sleep(11);
skynet.sleep(1);
local ret = db[db_name].testdb:findOne({test_key = 1})
if ret == nil then
@@ -104,10 +96,13 @@ function test_expire_index()
end
skynet.start(function()
print("Test insert without index")
test_insert_without_index()
print("Test insert index")
test_insert_with_index()
print("Test find and remove")
test_find_and_remove()
print("Test expire index")
test_expire_index()
print("mongodb test finish.");
end)