Ejemplo n.º 1
0
def parse_args(argv=None):
    parser = ArgumentParser()
    parser.add_argument('--upgrade', action="store_true", default=False,
                        help='Perform an upgrade test.')
    parser.add_argument('bundle_path',
                        help='URL or path to a bundle')
    add_basic_testing_arguments(parser)
    parser.add_argument('--allow-native-deploy', action='store_true',
                        help='Let juju 2 use native bundle deploying.')
    parser.add_argument('--bundle-verification-script',
                        help='Script to verify the bundle.')
    parser.add_argument('--bundle-name', default=None,
                        help='Name of the bundle to deploy.')
    parser.add_argument('--health-cmd', default=None,
                        help='A binary for checking the health of the'
                        ' deployed bundle.')
    parser.add_argument('--upgrade-condition', action='append', default=None,
                        help='unit_name:<conditions>'
                        ' One or more of the following conditions to apply'
                        ' to the given unit_name: clock_skew.')
    parser.add_argument('--agent-timeout', type=int, default=1200,
                        help='The time to wait for agents to start')
    parser.add_argument('--workload-timeout', type=int, default=1800,
                        help='The time to wait for workloads to active')
    args = parser.parse_args(argv)
    if args.allow_native_deploy and args.bundle_name:
        parser.error('cannot supply bundle name with native juju deploying')
    return args
Ejemplo n.º 2
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="Test staging store.")
    parser.add_argument('charm_store_ip', help="Charm store address.")
    add_basic_testing_arguments(parser)
    parser.add_argument('--charm', default='ubuntu', help='Charm to deploy.')
    return parser.parse_args(argv)
Ejemplo n.º 3
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description='Test if juju properly adds credentials with the '
        'add-credential command.')
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
Ejemplo n.º 4
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description='Test if juju drops selection of the current model '
        'when that model is destroyed.')
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
Ejemplo n.º 5
0
def parse_args(argv):
    """Parse all arguments."""

    parser = argparse.ArgumentParser(
        description="Test juju-status of charm and its subordinate charm")
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
Ejemplo n.º 6
0
def parse_args(argv):
    """Parse all arguments."""

    parser = argparse.ArgumentParser(
        description="Test juju-status of charm and its subordinate charm")
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description='Test if juju properly adds credentials with the '
        'add-credential command.')
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
def parse_args(argv):
    """Parse all arguments."""

    parser = argparse.ArgumentParser(
        description="Testing sync tools operates correctly")
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
Ejemplo n.º 9
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description='Test if juju drops selection of the current model '
        'when that model is destroyed.')
    add_basic_testing_arguments(parser)
    return parser.parse_args(argv)
Ejemplo n.º 10
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="Test staging store.")
    parser.add_argument('charm_store_ip', help="Charm store address.")
    add_basic_testing_arguments(parser)
    parser.add_argument('--charm', default='ubuntu', help='Charm to deploy.')
    return parser.parse_args(argv)
Ejemplo n.º 11
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description='Assess the model-defaults command.')
    add_basic_testing_arguments(parser)
    parser.add_argument('--other-region',
                        help='Set the model default for a different region.')
    return parser.parse_args(argv)
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description='Assess the model-defaults command.')
    add_basic_testing_arguments(parser)
    parser.add_argument('--other-region',
                        help='Set the model default for a different region.')
    return parser.parse_args(argv)
Ejemplo n.º 13
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="assess endpoint bindings")
    add_basic_testing_arguments(parser)
    args = parser.parse_args(argv)
    if args.upload_tools:
        parser.error("giving --upload-tools meaningless on 2.0 only test")
    return args
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="assess endpoint bindings")
    add_basic_testing_arguments(parser)
    args = parser.parse_args(argv)
    if args.upload_tools:
        parser.error("giving --upload-tools meaningless on 2.0 only test")
    return args
Ejemplo n.º 15
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Test multi series charm feature")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--devel-series', default="yakkety",
        help="The series to use when testing new and unsupported scenarios.")
    return parser.parse_args(argv)
Ejemplo n.º 16
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Deploy images from two sets of simplestreams.")
    add_basic_testing_arguments(parser)
    # Fallback behaviour fails without --bootstrap-series: Bug 1560625
    parser.set_defaults(series='trusty')
    parser.add_argument('--image-metadata-url')
    return parser.parse_args(argv)
Ejemplo n.º 17
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Test model migration feature")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--use-develop',
        action='store_true',
        help='Run tests that rely on features in the develop branch.')
    return parser.parse_args(argv)
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Test multi series charm feature")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--devel-series',
        default="yakkety",
        help="The series to use when testing new and unsupported scenarios.")
    return parser.parse_args(argv)
Ejemplo n.º 19
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Test model migration feature")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--use-develop',
        action='store_true',
        help='Run tests that rely on features in the develop branch.')
    return parser.parse_args(argv)
Ejemplo n.º 20
0
def add_basic_perfscale_arguments(parser):
    """Add the basic required args needed for a perfscale test."""
    add_basic_testing_arguments(parser)
    parser.add_argument('--enable-ha',
                        help='Enable HA before running perfscale test.',
                        action='store_true')
    parser.add_argument(
        '--enable-pprof',
        help='Enable pprof profile collection during test run.',
        action='store_true')
Ejemplo n.º 21
0
def parse_args(argv):
    """Parse all arguments."""
    parser = ArgumentParser(
        description="Test bootstrap for agent-metdadata-url")

    add_basic_testing_arguments(parser)

    parser.add_argument('--agent-file', required=True, action='store',
                        help='agent file to be used during bootstrap.')

    return parser.parse_args(argv)
Ejemplo n.º 22
0
def add_basic_perfscale_arguments(parser):
    """Add the basic required args needed for a perfscale test."""
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--enable-ha',
        help='Enable HA before running perfscale test.',
        action='store_true')
    parser.add_argument(
        '--enable-pprof',
        help='Enable pprof profile collection during test run.',
        action='store_true')
Ejemplo n.º 23
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Perfscale longrunning test.")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--run-length',
        help='Length of time (in hours) to run the test',
        type=int,
        default=12)
    return parser.parse_args(argv)
Ejemplo n.º 24
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="Assess resources")
    add_basic_testing_arguments(parser)
    parser.add_argument('--large-test-enabled', action='store_true',
                        help="Uses large file for testing.")
    parser.add_argument('--agent-timeout', type=int, default=1800,
                        help='The time to wait for agents to start')
    parser.add_argument('--resource-timeout', type=int, default=1800,
                        help='The time to wait for agents to start')

    return parser.parse_args(argv)
Ejemplo n.º 25
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="Test Network Health")
    add_basic_testing_arguments(parser)
    parser.add_argument('--bundle', help='Bundle to test network against')
    parser.add_argument('--model', help='Existing Juju model to test against')
    parser.add_argument('--reboot', type=bool,
                        help='Reboot machines and re-run tests, default=False')
    parser.add_argument('--maas', type=bool,
                        help='Test under maas')
    parser.set_defaults(maas=False)
    parser.set_defaults(reboot=False)
    parser.set_defaults(series='xenial')
    return parser.parse_args(argv)
Ejemplo n.º 26
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="Test Network Health")
    add_basic_testing_arguments(parser)
    parser.add_argument('--bundle', help='Bundle to test network against')
    parser.add_argument('--model', help='Existing Juju model to test against')
    parser.add_argument('--reboot',
                        type=bool,
                        help='Reboot machines and re-run tests, default=False')
    parser.add_argument('--maas', type=bool, help='Test under maas')
    parser.set_defaults(maas=False)
    parser.set_defaults(reboot=False)
    parser.set_defaults(series='xenial')
    return parser.parse_args(argv)
Ejemplo n.º 27
0
def parse_args(argv=None):
    """Parse all arguments.

    In addition to the basic testing arguments this script also accepts:
    part: The first argument, which is the name of test part to run.
    --local-metadata-source: If given it should be a directory that contains
    the agent to use in the test. This skips downloading them."""
    parser = ArgumentParser(description='Test the bootstrap command.')
    parser.add_argument('part', choices=['base', 'metadata', 'to'],
                        help='Which part of bootstrap to assess')
    add_basic_testing_arguments(parser)
    parser.add_argument('--local-metadata-source',
                        action='store', default=None,
                        help='Directory with pre-loaded metadata.')
    return parser.parse_args(argv)
Ejemplo n.º 28
0
 def test_keep_env(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--keep-env'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertTrue(args.keep_env)
Ejemplo n.º 29
0
def parse_args(argv=None):
    parser = ArgumentParser(description='Test recovery strategies.')
    add_basic_testing_arguments(parser)
    parser.add_argument(
        '--charm-series', help='Charm series.', default='')
    strategy = parser.add_argument_group('test strategy')
    strategy.add_argument(
        '--ha', action='store_const', dest='strategy', const='ha',
        default='backup', help="Test HA.")
    strategy.add_argument(
        '--backup', action='store_const', dest='strategy', const='backup',
        help="Test backup/restore.")
    strategy.add_argument(
        '--ha-backup', action='store_const', dest='strategy',
        const='ha-backup', help="Test backup/restore of HA.")
    return parser.parse_args(argv)
Ejemplo n.º 30
0
 def test_series(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--series', 'vivid'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertEqual(args.series, 'vivid')
Ejemplo n.º 31
0
def parse_args(argv=None):
    """Parse all arguments."""

    description = dedent("""\
    Test container address allocation.
    For LXC and KVM, create machines of each type and test the network
    between LXC <--> LXC, KVM <--> KVM and LXC <--> KVM. Also test machine
    to outside world, DNS and that these tests still pass after a reboot. In
    case of failure pull logs and configuration files from the machine that
    we detected a problem on for later analysis.
    """)
    parser = add_basic_testing_arguments(ArgumentParser(
        description=description
    ))
    parser.add_argument(
        '--clean-environment', action='store_true', help=dedent("""\
        Attempts to re-use an existing environment rather than destroying it
        and creating a new one.

        On launch, if an environment exists, clean out services and machines
        from it rather than destroying it. If an environment doesn't exist,
        create one and use it.

        At termination, clean out services and machines from the environment
        rather than destroying it."""))
    return parser.parse_args(argv)
Ejemplo n.º 32
0
 def test_upload_tools(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--upload-tools'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertTrue(args.upload_tools)
def parse_args(argv=None):
    """Parse all arguments."""

    description = dedent("""\
    Test container address allocation.
    For LXC and KVM, create machines of each type and test the network
    between LXC <--> LXC, KVM <--> KVM and LXC <--> KVM. Also test machine
    to outside world, DNS and that these tests still pass after a reboot. In
    case of failure pull logs and configuration files from the machine that
    we detected a problem on for later analysis.
    """)
    parser = add_basic_testing_arguments(
        ArgumentParser(description=description))
    parser.add_argument('--clean-environment',
                        action='store_true',
                        help=dedent("""\
        Attempts to re-use an existing environment rather than destroying it
        and creating a new one.

        On launch, if an environment exists, clean out services and machines
        from it rather than destroying it. If an environment doesn't exist,
        create one and use it.

        At termination, clean out services and machines from the environment
        rather than destroying it."""))
    return parser.parse_args(argv)
Ejemplo n.º 34
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Assess Juju under various proxy network conditions.")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        'scenario', choices=[
            SCENARIO_BOTH, SCENARIO_CLIENT, SCENARIO_CONTROLLER],
        help="The proxy scenario to run.")
    parser.add_argument(
        '--client-interface', default='eth0',
        help="The interface used by the client to access the internet.")
    parser.add_argument(
        '--controller-interface', default='lxdbr0',
        help="The interface used by the controller to access the internet.")
    return parser.parse_args(argv)
Ejemplo n.º 35
0
 def test_using_jes_upload_tools(self):
     cmd_line = ['local', '/foo/juju', '/tmp/logs', 'testtest',
                 '--upload-tools']
     parser = add_basic_testing_arguments(ArgumentParser(), using_jes=True)
     with patch.object(parser, 'error') as mock_error:
         parser.parse_args(cmd_line)
     mock_error.assert_called_once_with(
         'unrecognized arguments: --upload-tools')
Ejemplo n.º 36
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(description="Assess resources")
    add_basic_testing_arguments(parser)
    parser.add_argument('--large-test-enabled',
                        action='store_true',
                        help="Uses large file for testing.")
    parser.add_argument('--agent-timeout',
                        type=int,
                        default=1800,
                        help='The time to wait for agents to start')
    parser.add_argument('--resource-timeout',
                        type=int,
                        default=1800,
                        help='The time to wait for agents to start')

    return parser.parse_args(argv)
Ejemplo n.º 37
0
def parse_args(argv=None):
    """Parse all arguments.

    In addition to the basic testing arguments this script also accepts:
    part: The first argument, which is the name of test part to run.
    --local-metadata-source: If given it should be a directory that contains
    the agent to use in the test. This skips downloading them."""
    parser = ArgumentParser(description='Test the bootstrap command.')
    parser.add_argument('part',
                        choices=['base', 'metadata', 'to'],
                        help='Which part of bootstrap to assess')
    add_basic_testing_arguments(parser)
    parser.add_argument('--local-metadata-source',
                        action='store',
                        default=None,
                        help='Directory with pre-loaded metadata.')
    return parser.parse_args(argv)
Ejemplo n.º 38
0
def parse_args(argv=None):
    """Parse all arguments."""
    parser = add_basic_testing_arguments(
        ArgumentParser(description='Test log rotation.'), deadline=False)
    parser.add_argument('agent',
                        help='Which agent log rotation to test.',
                        choices=['machine', 'unit'])
    return parser.parse_args(argv)
Ejemplo n.º 39
0
def deploy_job_parse_args(argv=None):
    parser = ArgumentParser('deploy_job')
    add_basic_testing_arguments(parser)
    parser.add_argument('--upgrade', action="store_true", default=False,
                        help='Perform an upgrade test.')
    parser.add_argument('--with-chaos', default=0, type=int,
                        help='Deploy and run Chaos Monkey in the background.')
    parser.add_argument('--jes', action='store_true',
                        help='Use JES to control environments.')
    parser.add_argument(
        '--controller-host', help=(
            'Host with a controller to use.  If supplied, SSO_EMAIL and'
            ' SSO_PASSWORD environment variables will be used for oauth'
            ' authentication.'))
    parser.add_argument('--use-charmstore', action='store_true',
                        help='Deploy dummy charms from the charmstore.')
    return parser.parse_args(argv)
Ejemplo n.º 40
0
 def test_bootstrap_host(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--bootstrap-host',
         'bar'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertEqual(args.bootstrap_host, 'bar')
Ejemplo n.º 41
0
 def test_machine(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--machine', 'bar',
         '--machine', 'baz'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertEqual(args.machine, ['bar', 'baz'])
Ejemplo n.º 42
0
 def test_agent_url(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--agent-url',
         'http://example.org'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertEqual(args.agent_url, 'http://example.org')
Ejemplo n.º 43
0
 def test_region(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--region',
         'foo-bar'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertEqual('foo-bar', args.region)
Ejemplo n.º 44
0
 def test_agent_stream(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--agent-stream',
         'testing'
     ]
     parser = add_basic_testing_arguments(ArgumentParser())
     args = parser.parse_args(cmd_line)
     self.assertEqual(args.agent_stream, 'testing')
Ejemplo n.º 45
0
def parse_args(argv):
    """Parse all arguments."""
    parser = argparse.ArgumentParser(
        description="Assess Juju under various proxy network conditions.")
    add_basic_testing_arguments(parser)
    parser.add_argument(
        'scenario',
        choices=[SCENARIO_BOTH, SCENARIO_CLIENT, SCENARIO_CONTROLLER],
        help="The proxy scenario to run.")
    parser.add_argument(
        '--client-interface',
        default='eth0',
        help="The interface used by the client to access the internet.")
    parser.add_argument(
        '--controller-interface',
        default='lxdbr0',
        help="The interface used by the controller to access the internet.")
    return parser.parse_args(argv)
Ejemplo n.º 46
0
 def test_using_jes_upload_tools(self):
     cmd_line = [
         'local', '/foo/juju', '/tmp/logs', 'testtest', '--upload-tools'
     ]
     parser = add_basic_testing_arguments(ArgumentParser(), using_jes=True)
     with patch.object(parser, 'error') as mock_error:
         parser.parse_args(cmd_line)
     mock_error.assert_called_once_with(
         'unrecognized arguments: --upload-tools')
Ejemplo n.º 47
0
 def test_deadline(self):
     now = datetime(2012, 11, 10, 9, 8, 7)
     cmd_line = ['--timeout', '300']
     parser = add_basic_testing_arguments(ArgumentParser(), deadline=True)
     with patch('utility.datetime') as dt_class:
         # Can't patch the utcnow method of datetime.datetime (because it's
         # C code?) but we can patch out the whole datetime class.
         dt_class.utcnow.return_value = now
         args = parser.parse_args(cmd_line)
     self.assertEqual(now + timedelta(seconds=300), args.deadline)
Ejemplo n.º 48
0
 def test_no_warn_on_empty_logs(self):
     """Special case a file named 'empty' doesn't make log dir dirty"""
     with warnings.catch_warnings(record=True) as warned:
         with temp_dir() as log_dir:
             open(os.path.join(log_dir, "empty"), "w").close()
             cmd_line = ['local', '/a/juju', log_dir, 'testtest']
             parser = add_basic_testing_arguments(ArgumentParser())
             parser.parse_args(cmd_line)
         self.assertEqual(warned, [])
     self.assertEqual("", self.log_stream.getvalue())
Ejemplo n.º 49
0
    def test_no_warn_on_help(self):
        """Special case help should not generate a warning"""
        with warnings.catch_warnings(record=True) as warned:
            with patch('utility.sys.exit'):
                parser = add_basic_testing_arguments(ArgumentParser())
                cmd_line = ['-h']
                parser.parse_args(cmd_line)
                cmd_line = ['--help']
                parser.parse_args(cmd_line)

            self.assertEqual(warned, [])
Ejemplo n.º 50
0
 def test_no_env(self):
     cmd_line = ['/foo/juju', '/tmp/logs', 'testtest']
     parser = add_basic_testing_arguments(ArgumentParser(), env=False)
     args = parser.parse_args(cmd_line)
     expected = Namespace(
         agent_url=None, debug=False, temp_env_name='testtest',
         juju_bin='/foo/juju', logs='/tmp/logs', series=None,
         verbose=logging.INFO, agent_stream=None, keep_env=False,
         upload_tools=False, bootstrap_host=None, machine=[], region=None,
         deadline=None, to=None)
     self.assertEqual(args, expected)
Ejemplo n.º 51
0
 def test_warn_on_nonexistent_directory_creation(self):
     with warnings.catch_warnings(record=True) as warned:
         log_dir = mkdtemp()
         os.rmdir(log_dir)
         cmd_line = ['local', '/foo/juju', log_dir, 'testtest']
         parser = add_basic_testing_arguments(ArgumentParser())
         parser.parse_args(cmd_line)
         self.assertEqual(len(warned), 1)
         self.assertRegexpMatches(
             str(warned[0].message),
             r"Not a directory " + log_dir)
         self.assertEqual("", self.log_stream.getvalue())
Ejemplo n.º 52
0
def parse_args(args):
    parser = ArgumentParser(description=dedent("""\
        Test a specified cloud.

        This tests basic provider operations and charm store support.

        The cloud.yaml file must be provided, followed by the name of the
        cloud to test.
        """))
    subparsers = parser.add_subparsers(dest='test')
    for test in ['combined', 'kill-controller', 'provisioning']:
        subparser = subparsers.add_parser(test)
        subparser.add_argument('clouds_file',
                               help='A clouds.yaml file to use for testing.')
        subparser.add_argument('cloud', help='Specific cloud to test.')
        add_basic_testing_arguments(subparser, env=False)
        subparser.add_argument('--config')
        if test == 'provisioning':
            subparser.add_argument('--machine-series', action='append',
                                   help='A machine series to add.')
    return parser.parse_args(args)
Ejemplo n.º 53
0
 def test_warns_on_dirty_logs(self):
     with warnings.catch_warnings(record=True) as warned:
         with temp_dir() as log_dir:
             open(os.path.join(log_dir, "existing.log"), "w").close()
             cmd_line = ['local', '/a/juju', log_dir, 'testtest']
             parser = add_basic_testing_arguments(ArgumentParser())
             parser.parse_args(cmd_line)
         self.assertEqual(len(warned), 1)
         self.assertRegexpMatches(
             str(warned[0].message),
             r"^Directory '.*' has existing contents.$")
     self.assertEqual("", self.log_stream.getvalue())
Ejemplo n.º 54
0
    def test_no_args(self):
        cmd_line = []
        parser = add_basic_testing_arguments(ArgumentParser(),
                                             deadline=True)
        args = parser.parse_args(cmd_line)
        self.assertEqual(args.env, 'lxd')
        self.assertEqual(args.juju_bin, None)

        self.assertEqual(args.logs, None)

        temp_env_name_arg = args.temp_env_name.split("-")
        temp_env_name_ts = temp_env_name_arg[1]
        self.assertEqual(temp_env_name_arg[0:1], ['testutility'])
        self.assertTrue(temp_env_name_ts,
                        datetime.strptime(temp_env_name_ts, "%Y%m%d%H%M%S"))
        self.assertEqual(temp_env_name_arg[2:4], ['temp', 'env'])
        self.assertIs(None, args.deadline)
Ejemplo n.º 55
0
def main():
    parser = add_basic_testing_arguments(ArgumentParser())
    parser.add_argument('bundle_path',
                        help='URL or path to a bundle')
    parser.add_argument('--service-count', type=int, default=2,
                        help='Minimum number of expected services.')
    args = parser.parse_args()
    configure_logging(args.verbose)
    bs_manager = BootstrapManager.from_args(args)
    quickstart = QuickstartTest(
        bs_manager, args.bundle_path, args.service_count)
    try:
        quickstart.run()
    except LoggedException:
        sys.exit(1)
    except Exception as e:
        print('%s (%s)' % (e, type(e).__name__))
        sys.exit(1)
Ejemplo n.º 56
0
def parse_args(argv=None):
    """Parse all arguments."""

    description = dedent("""\
    Test container address allocation.
    For LXC and KVM, create machines of each type and test the network
    between LXC <--> LXC, KVM <--> KVM and LXC <--> KVM. Also test machine
    to outside world, DNS and that these tests still pass after a reboot. In
    case of failure pull logs and configuration files from the machine that
    we detected a problem on for later analysis.
    """)
    parser = add_basic_testing_arguments(ArgumentParser(
        description=description
    ))
    parser.add_argument(
        '--machine-type',
        help='Which virtual machine/container type to test. Defaults to all.',
        choices=[KVM_MACHINE, LXC_MACHINE, LXD_MACHINE])
    args = parser.parse_args(argv)
    return args