Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where sparse run wasn't using environment when set #305

Merged
merged 2 commits into from
Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion streamparse/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ def subparser_hook(subparsers):

def main(args):
"""Run the local topology with the given arguments"""
run_local_topology(name=args.name, time=args.time, options=args.options)
run_local_topology(name=args.name, time=args.time, options=args.options,
env_name=args.environment)
42 changes: 42 additions & 0 deletions test/streamparse/cli/test_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from __future__ import absolute_import, unicode_literals

import argparse
import unittest

from nose.tools import ok_
try:
from unittest.mock import patch
except ImportError:
from mock import patch

from streamparse.cli.run import main, subparser_hook


class RunTestCase(unittest.TestCase):

def test_subparser_hook(self):
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
subparser_hook(subparsers)

subcommands = parser._optionals._actions[1].choices.keys()
ok_('run' in subcommands)


@patch('streamparse.cli.run.run_local_topology', autospec=True)
def test_main_args_passed(self, run_local_mock):
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
subparser_hook(subparsers)

args = parser.parse_args('run -e my_env -n my_topo --ackers 1'.split())

main(args)
run_local_mock.assert_called_with(name='my_topo',
options={'topology.acker.executors': 1},
env_name='my_env',
time=0)


if __name__ == '__main__':
unittest.main()