Skip to content

Commit

Permalink
Merge pull request #186 from PDXCapstoneF/bs-multiple-props
Browse files Browse the repository at this point in the history
Fix issue where users could get too specific with props files and component types
  • Loading branch information
Zonr0 committed May 24, 2018
2 parents 104bea4 + 952c1f3 commit e9f1712
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/benchmark_run.py
Expand Up @@ -152,6 +152,10 @@ def __init__(self, component_type, rest=None):
else:
raise Exception(
"Unrecognized 'rest' given to SpecJBBComponentOptions: {}".format(rest))
if "-p" in self["options"]:
raise Exception("SpecJBBComponentOptions recieved external props file")
if "-m" in self["options"]:
raise Exception("SpecJBBComponentOptions recieved manual component type")


class SpecJBBRun:
Expand Down
19 changes: 19 additions & 0 deletions tests/test_benchmark_run.py
Expand Up @@ -296,6 +296,25 @@ def test_given_dict(self):
self.assertEqual(co["options"], options)
self.assertEqual(co["jvm_opts"], jvm_opts)

def test_refuses_extra_prop_files(self):
options = ["-p", "an_extra_props_file.props"]

def construct_all_types(c):
with self.assertRaises(Exception):
SpecJBBComponentOptions(c, { "options": options })

component_options = list(map(construct_all_types, SpecJBBComponentTypes))

def test_refuses_setting_component_type(self):
options = ["-p", "an_extra_props_file.props"]

def construct_all_types(c):
with self.assertRaises(Exception):
SpecJBBComponentOptions(c, { "options": options })

component_options = list(map(construct_all_types, SpecJBBComponentTypes))



class TestDo(unittest.TestCase):
def test_do_calls_run_method_on_objects(self):
Expand Down

0 comments on commit e9f1712

Please sign in to comment.