Esempio n. 1
0
# TEST TIME!
print("Napping just in case...")
time.sleep(5)

client['test'].test.insert(deploy)

for x in range(0, 5):
    print("Running iteration " + str(x))
    start = timer()
    print(client['test'].test.find_one())
    ts = timer() - start
    print("Time: " + str(ts))
    time.sleep(6)

# Simulating the primary becoming a TCP black hole
docker.block("mongo_D1")
print("Napping 30 sec")
time.sleep(30)

for x in range(0, 5):
    print("Running iteration " + str(x))
    start = timer()
    print(client['test'].test.find_one())
    ts = timer() - start
    print("Time: " + str(ts))
    time.sleep(6)

print("Done")

# cleanup
docker.cleanup()
Esempio n. 2
0
time.sleep(5)

client['test'].test.insert(deploy)
client.admin.command('flushRouterConfig', 1)

print("----NORMAL QUERY----")
for x in range(0, 5):
	print("Running iteration " + str(x))
	start = timer()
	print(client['test'].test.find_one())
	ts = timer() - start
	print("Time: " + str(ts))
	time.sleep(6)

print("----BLOCKING CFG1----")
docker.block("mongo_CFG1")
print("Napping 30 sec")
time.sleep(30)
print("----GOGOGO----");
start = timer()
clientX = MongoClient('mongo_S1', 27017, read_preference=ReadPreference.PRIMARY_PREFERRED)
ts = timer() - start
print("Time to establish new connection: " + str(ts))

for x in range(0, 5):
        print("+++EXISTING CONN find:Running iteration " + str(x))
        start = timer()
        try:
            print(client['test'].test.find_one())
        except:
            print "+++Unexpected error:", sys.exc_info()[0]
Esempio n. 3
0
print("Napping just in case...")
time.sleep(5)

client['test'].test.insert(deploy)
client.admin.command('flushRouterConfig', 1)
#for x in range(0, 5):
#	print("Running iteration " + str(x))
#	start = timer()
#	print(client['test'].test.find_one())
#	ts = timer() - start
#	print("Time: " + str(ts))
#	time.sleep(6)


time.sleep(30)
docker.block("mongo_D1")
print("Napping 30 sec")
time.sleep(30)
print("GOGOGO");
clientX = MongoClient('mongo_S1', 27017, read_preference=ReadPreference.PRIMARY_PREFERRED)

for x in range(0, 5):
        print("Running iteration " + str(x))
        start = timer()
        try:
            print(clientX['test'].test.find_one())
        except:
            print "Unexpected error:", sys.exc_info()[0]
        ts = timer() - start
        print("Time: " + str(ts))
        time.sleep(6)
Esempio n. 4
0
time.sleep(5)

client['test'].test.insert(deploy)
client.admin.command('flushRouterConfig', 1)

print("----NORMAL QUERY----")
for x in range(0, 5):
    print("Running iteration " + str(x))
    start = timer()
    print(client['test'].test.find_one())
    ts = timer() - start
    print("Time: " + str(ts))
    time.sleep(6)

print("----BLOCKING CFG1----")
docker.block("mongo_CFG1")
print("Napping 30 sec")
time.sleep(30)
print("----GOGOGO----")
start = timer()
clientX = MongoClient('mongo_S1',
                      27017,
                      read_preference=ReadPreference.PRIMARY_PREFERRED)
ts = timer() - start
print("Time to establish new connection: " + str(ts))

for x in range(0, 5):
    print("+++EXISTING CONN find:Running iteration " + str(x))
    start = timer()
    try:
        print(client['test'].test.find_one())