Exemple #1
0
    def test_make_help_options(self, resolve_mock, walk_mock):
        base_dir = 'abc/def'
        abs_dir = '/files/' + base_dir
        walk_mock.side_effect = [
            [(abs_dir, [], ['klm.yaml']), (abs_dir, [], ['ijk.yaml'])],
        ]
        resolve_mock.side_effect = [abs_dir]

        expected = 'List: "ijk", "klm"'
        observed = utils.make_help_options('List: %s', base_dir)
        self.assertEqual(expected, observed)
Exemple #2
0
    def test_make_help_options_with_filter(self, resolve_mock, walk_mock):
        base_dir = 'abc/def'
        abs_dir = '/files/' + base_dir
        walk_mock.side_effect = [
            [(abs_dir + '/sub', [], ['klm.yaml']),
             (abs_dir + '/sub', [], ['ijk.html']),
             (abs_dir + '/sub', [], ['mno.yaml'])],
        ]
        resolve_mock.side_effect = [abs_dir]

        expected = 'List: "sub/klm", "sub/mno"'
        observed = utils.make_help_options(
            'List: %s', base_dir, type_filter=lambda x: x.endswith('.yaml'))
        self.assertEqual(expected, observed)
Exemple #3
0
               default=utils.env('SHAKER_AGENT_LOSS_TIMEOUT') or 60,
               help='Timeout to treat agent as lost in seconds'),
    cfg.IntOpt('agent-join-timeout',
               default=utils.env('SHAKER_AGENT_JOIN_TIMEOUT') or 600,
               help='How long to wait for agents to join in seconds (time '
               'between stack deployment and start of scenario '
               'execution).'),
]

SCENARIO_OPTS = [
    cfg.StrOpt('scenario',
               default=utils.env('SHAKER_SCENARIO'),
               required=True,
               help=utils.make_help_options(
                   'Scenario to play. Can be a file name or one of aliases: '
                   '%s. Defaults to env[SHAKER_SCENARIO].',
                   SCENARIOS,
                   type_filter=lambda x: x.endswith('.yaml'))),
    cfg.Opt('matrix',
            default=utils.env('SHAKER_MATRIX'),
            type=Yaml(),
            help='Set the matrix of parameters for the scenario. The value '
            'is specified in YAML format. E.g. to override the scenario '
            'duration one may provide: "{time: 10}", or to override list '
            'of hosts: "{host:[ping.online.net, iperf.eenet.ee]}". When '
            'several parameters are overridden all combinations are '
            'tested'),
    cfg.StrOpt('output',
               default=utils.env('SHAKER_OUTPUT'),
               help='File for output in JSON format, '
               'defaults to env[SHAKER_OUTPUT].'),
Exemple #4
0
                    'defaults to env[SHAKER_AGENT_LOSS_TIMEOUT]'),
    cfg.IntOpt('agent-join-timeout',
               default=utils.env('SHAKER_AGENT_JOIN_TIMEOUT') or 600,
               help='Timeout to treat agent as join failed in seconds, '
                    'defaults to env[SHAKER_AGENT_JOIN_TIMEOUT] (time '
                    'between stack deployment and start of scenario '
                    'execution).'),
]

SCENARIO_OPTS = [
    cfg.ListOpt('scenario',
                default=utils.env('SHAKER_SCENARIO'),
                required=True,
                help=utils.make_help_options(
                    'Comma-separated list of scenarios to play. Each entity '
                    'can be a file name or one of aliases: '
                    '%s. Defaults to env[SHAKER_SCENARIO].', SCENARIOS,
                    type_filter=lambda x: (x.endswith('.yaml')
                                           and not x.startswith('test/')))),
    cfg.Opt('matrix',
            default=utils.env('SHAKER_MATRIX'),
            type=Yaml(),
            help='Set the matrix of parameters for the scenario. The value '
                 'is specified in YAML format. E.g. to override the scenario '
                 'duration one may provide: "{time: 10}", or to override list '
                 'of hosts: "{host:[ping.online.net, iperf.eenet.ee]}". When '
                 'several parameters are overridden all combinations are '
                 'tested'),
    cfg.StrOpt('output',
               default=utils.env('SHAKER_OUTPUT') or generate_output_name(),
               sample_default='',
               help='File for output in JSON format, '
Exemple #5
0
    cfg.IntOpt('agent-loss-timeout',
               default=utils.env('SHAKER_AGENT_LOSS_TIMEOUT') or 60,
               help='Timeout to treat agent as lost in seconds'),
    cfg.IntOpt('agent-join-timeout',
               default=utils.env('SHAKER_AGENT_JOIN_TIMEOUT') or 600,
               help='How long to wait for agents to join in seconds (time '
                    'between stack deployment and start of scenario '
                    'execution).'),
]

SCENARIO_OPTS = [
    cfg.StrOpt('scenario',
               default=utils.env('SHAKER_SCENARIO'),
               required=True,
               help=utils.make_help_options(
                   'Scenario to play. Can be a file name or one of aliases: '
                   '%s. Defaults to env[SHAKER_SCENARIO].', SCENARIOS,
                   type_filter=lambda x: x.endswith('.yaml'))),
    cfg.Opt('matrix',
            default=utils.env('SHAKER_MATRIX'),
            type=Yaml(),
            help='Set the matrix of parameters for the scenario. The value '
                 'is specified in YAML format. E.g. to override the scenario '
                 'duration one may provide: "{time: 10}", or to override list '
                 'of hosts: "{host:[ping.online.net, iperf.eenet.ee]}". When '
                 'several parameters are overridden all combinations are '
                 'tested'),
    cfg.StrOpt('output',
               default=utils.env('SHAKER_OUTPUT'),
               help='File for output in JSON format, '
                    'defaults to env[SHAKER_OUTPUT].'),
    cfg.BoolOpt('no-report-on-error',