Skip to content

Commit

Permalink
Merge pull request twitter#75 from TomekIdczak97/ungraceful
Browse files Browse the repository at this point in the history
Integration tests fail assertion fix
  • Loading branch information
michalbiesek authored Sep 16, 2019
2 parents 047d766 + fb13071 commit 6777c82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ set(test_name integration)

include(FindPythonInterp)

if(USE_PMEM)
set(test_arg --pmem)
endif(USE_PMEM)

add_test(NAME ${test_name}
COMMAND ${PYTHON_EXECUTABLE} test_twemcache.py
COMMAND ${PYTHON_EXECUTABLE} test_twemcache.py ${test_arg}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
15 changes: 12 additions & 3 deletions test/integration/test_twemcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from base import GenericPmemTest

import os
import sys
import argparse
import unittest
import ConfigParser
import StringIO
Expand All @@ -11,12 +13,13 @@ def defineTest(suite, fname, test_type):
test.load('twemcache/' + fname)
suite.addTest(test)

def twemcache():
def twemcache(pmem_flag=False):
suite = unittest.TestSuite()
for fname in sorted(os.listdir('twemcache')):
if not os.path.isdir('twemcache/' + fname):
defineTest(suite, fname, GenericTest)
defineTest(suite, fname, GenericPmemTest)
if pmem_flag:
defineTest(suite, fname, GenericPmemTest)

return suite

Expand All @@ -33,5 +36,11 @@ def removeDevice():
os.remove(devpath)

if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(twemcache())
parser = argparse.ArgumentParser(description='Run integration test.')
parser.add_argument("--pmem", help="use pmem", action="store_true")
args = parser.parse_args()
result = unittest.TextTestRunner(verbosity=2).run(twemcache(args.pmem))
removeDevice()
if result.wasSuccessful():
sys.exit(0)
sys.exit(1)

0 comments on commit 6777c82

Please sign in to comment.