Commit 1d9c272a by Calen Pennington Committed by Nimisha Asthagiri

LMS-11282 Paver Lettuce Acceptance support for Split; default store set to Draft.

parent 4d362765
...@@ -19,6 +19,7 @@ __test__ = False # do not collect ...@@ -19,6 +19,7 @@ __test__ = False # do not collect
) )
@cmdopts([ @cmdopts([
("system=", "s", "System to act on"), ("system=", "s", "System to act on"),
("default_store=", "m", "Default modulestore to use for course creation"),
("fasttest", "a", "Run without collectstatic"), ("fasttest", "a", "Run without collectstatic"),
("extra_args=", "e", "adds as extra args to the test command"), ("extra_args=", "e", "adds as extra args to the test command"),
make_option("--verbose", action="store_const", const=2, dest="verbosity"), make_option("--verbose", action="store_const", const=2, dest="verbosity"),
...@@ -32,6 +33,7 @@ def test_acceptance(options): ...@@ -32,6 +33,7 @@ def test_acceptance(options):
opts = { opts = {
'fasttest': getattr(options, 'fasttest', False), 'fasttest': getattr(options, 'fasttest', False),
'system': getattr(options, 'system', None), 'system': getattr(options, 'system', None),
'default_store': getattr(options, 'default_store', None),
'verbosity': getattr(options, 'verbosity', 3), 'verbosity': getattr(options, 'verbosity', 3),
'extra_args': getattr(options, 'extra_args', ''), 'extra_args': getattr(options, 'extra_args', ''),
} }
...@@ -42,6 +44,12 @@ def test_acceptance(options): ...@@ -42,6 +44,12 @@ def test_acceptance(options):
'No system specified, running tests for both cms and lms.' 'No system specified, running tests for both cms and lms.'
) )
print(msg) print(msg)
if opts['default_store'] not in ['draft', 'split']:
msg = colorize(
'red',
'No modulestore specified, running tests for both draft and split.'
)
print(msg)
suite = AcceptanceTestSuite('{} acceptance'.format(opts['system']), **opts) suite = AcceptanceTestSuite('{} acceptance'.format(opts['system']), **opts)
suite.run() suite.run()
...@@ -17,7 +17,8 @@ class AcceptanceTest(TestSuite): ...@@ -17,7 +17,8 @@ class AcceptanceTest(TestSuite):
super(AcceptanceTest, self).__init__(*args, **kwargs) super(AcceptanceTest, self).__init__(*args, **kwargs)
self.report_dir = Env.REPORT_DIR / 'acceptance' self.report_dir = Env.REPORT_DIR / 'acceptance'
self.fasttest = kwargs.get('fasttest', False) self.fasttest = kwargs.get('fasttest', False)
self.system = kwargs.get('system', None) self.system = kwargs.get('system')
self.default_store = kwargs.get('default_store')
self.extra_args = kwargs.get('extra_args', '') self.extra_args = kwargs.get('extra_args', '')
def __enter__(self): def __enter__(self):
...@@ -35,9 +36,10 @@ class AcceptanceTest(TestSuite): ...@@ -35,9 +36,10 @@ class AcceptanceTest(TestSuite):
report_file = self.report_dir / "{}.xml".format(self.system) report_file = self.report_dir / "{}.xml".format(self.system)
report_args = "--with-xunit --xunit-file {}".format(report_file) report_args = "--with-xunit --xunit-file {}".format(report_file)
cmd = ( cmd = (
"./manage.py {system} --settings acceptance harvest --traceback " "DEFAULT_STORE={default_store} ./manage.py {system} --settings acceptance harvest --traceback "
"--debug-mode --verbosity {verbosity} {report_args} {extra_args}".format( "--debug-mode --verbosity {verbosity} {report_args} {extra_args}".format(
default_store=self.default_store,
system=self.system, system=self.system,
verbosity=self.verbosity, verbosity=self.verbosity,
report_args=report_args, report_args=report_args,
...@@ -65,24 +67,31 @@ class AcceptanceTestSuite(TestSuite): ...@@ -65,24 +67,31 @@ class AcceptanceTestSuite(TestSuite):
self.root = 'acceptance' self.root = 'acceptance'
self.db = Env.REPO_ROOT / 'test_root/db/test_edx.db' self.db = Env.REPO_ROOT / 'test_root/db/test_edx.db'
self.db_cache = Env.REPO_ROOT / 'common/test/db_cache/lettuce.db' self.db_cache = Env.REPO_ROOT / 'common/test/db_cache/lettuce.db'
self.system = kwargs.get('system', None)
self.fasttest = kwargs.get('fasttest', False) self.fasttest = kwargs.get('fasttest', False)
if self.system: if kwargs.get('system'):
self.subsuites = [ systems = [kwargs['system']]
AcceptanceTest('{} acceptance'.format(self.system), **kwargs),
]
else: else:
kwargs['system'] = 'lms' systems = ['lms', 'cms']
lms = AcceptanceTest('lms acceptance', **kwargs)
kwargs['system'] = 'cms' if kwargs.get('default_store'):
cms = AcceptanceTest('cms acceptance', **kwargs) stores = [kwargs['default_store']]
self.subsuites = [lms, cms] else:
# TODO fix Acceptance tests with Split (LMS-11300)
# stores = ['split', 'draft']
stores = ['draft']
self.subsuites = []
for system in systems:
for default_store in stores:
kwargs['system'] = system
kwargs['default_store'] = default_store
self.subsuites.append(AcceptanceTest('{} acceptance using {}'.format(system, default_store), **kwargs))
def __enter__(self): def __enter__(self):
super(AcceptanceTestSuite, self).__enter__() super(AcceptanceTestSuite, self).__enter__()
test_utils.clean_test_files() test_utils.clean_test_files()
if not self.fasttest: if not self.fasttest:
self._setup_acceptance_db() self._setup_acceptance_db()
...@@ -104,7 +113,7 @@ class AcceptanceTestSuite(TestSuite): ...@@ -104,7 +113,7 @@ class AcceptanceTestSuite(TestSuite):
if self.db.isfile(): if self.db.isfile():
# Since we are using SQLLite, we can reset the database by deleting it on disk. # Since we are using SQLLite, we can reset the database by deleting it on disk.
self.db.remove() self.db.remove()
if self.db_cache.isfile(): if self.db_cache.isfile():
# To speed up migrations, we check for a cached database file and start from that. # To speed up migrations, we check for a cached database file and start from that.
# The cached database file should be checked into the repo # The cached database file should be checked into the repo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment