示例#1
0
 def test_multiple_dash_ds(self):
     args = parse_args(
         self.config, ["-h", "host", "-d", "component", "-d", "component2"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual(
         "-h host --parallel=5 --timeout=60 -d component component2",
         canonical)
示例#2
0
    def test_profiles_arg(self):
        args = ["foo", "-h", "a", "-c", "test"]

        profile_info, args = self.profile_parser.parse_known_args(args=args)

        full_args = parse_args(self.config, args)

        self.assertEqual(profile_info.profile, "foo")
        self.assertEqual(cmdline(full_args.commands), [["test"]])
示例#3
0
 def test_multi_restart(self):
     args = parse_args(self.config, ["-h", "a", "-r", "all", "-r", "more"])
     self.assertEqual(cmdline(args.commands),
                      [["restart", "all"], ["restart", "more"]])
示例#4
0
 def test_dangerously_fast_on(self):
     args = parse_args(self.config, ["-h", "a", "--dangerously-fast"])
     self.assertTrue(args.dangerously_fast)
示例#5
0
 def test_verbose_flagged_long(self):
     args = parse_args(self.config, ["-h", "a", "--verbose"])
     self.assertTrue(args.verbose_logging)
示例#6
0
 def test_harold_disabled(self):
     args = parse_args(self.config, ["-h", "a", "--really-no-harold"])
     self.assertFalse(args.notify_harold)
示例#7
0
 def test_list_flagged(self):
     args = parse_args(self.config, ["-h", "a", "--list"])
     self.assertTrue(args.list_hosts)
示例#8
0
 def test_sleeptime_override(self):
     args = parse_args(self.config, ["-h", "a", "--sleeptime", "1"])
     self.assertEqual(args.sleeptime, 1)
示例#9
0
 def test_parallel_override(self):
     args = parse_args(self.config, ["-h", "a", "--parallel", "3"])
     self.assertEqual(args.parallel, 3)
示例#10
0
 def test_no_harold(self):
     args = parse_args(self.config, ["-h", "host", "--really-no-harold"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual(
         "-h host --parallel=5 --timeout=60 --really-no-harold", canonical)
示例#11
0
 def test_sleeptime(self):
     args = parse_args(self.config, ["-h", "host", "--sleeptime", "5"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual("-h host --parallel=5 --sleeptime=5 --timeout=60",
                      canonical)
示例#12
0
 def test_multiple_hosts(self):
     args = parse_args(self.config, ["-h", "host", "host2"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual("-h host host2 --parallel=5 --timeout=60", canonical)
示例#13
0
 def test_commands_together(self):
     args = parse_args(self.config,
                       ["-h", "a", "-c", "test", "args", "-r", "all"])
     self.assertEqual(cmdline(args.commands),
                      [["test", "args"], ["restart", "all"]])
示例#14
0
 def test_command_with_args(self):
     args = parse_args(self.config, ["-h", "a", "-c", "test", "args"])
     self.assertEqual(cmdline(args.commands), [["test", "args"]])
示例#15
0
 def test_no_commands(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertEqual(cmdline(args.commands), [])
示例#16
0
 def test_multiple_host_lists(self):
     args = parse_args(self.config, ["-h", "a", "-h", "b"])
     self.assertEqual(args.host_refs, ["a", "b"])
示例#17
0
 def test_parallel_default(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertEqual(args.parallel, 5)
示例#18
0
 def test_no_args(self):
     with self.assertRaises(SystemExit):
         parse_args(self.config, [])
示例#19
0
 def test_sleeptime_default(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertEqual(args.sleeptime, 2)
示例#20
0
 def test_multi_restart(self):
     args = parse_args(self.config,
                       ["-h", "host", "-r", "com1", "-r", "com2"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual("-h host --parallel=5 --timeout=60 -r com1 -r com2",
                      canonical)
示例#21
0
 def test_list_default(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertFalse(args.list_hosts)
示例#22
0
 def test_command_with_args(self):
     args = parse_args(self.config, ["-h", "host", "-c", "cmd", "arg"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual("-h host --parallel=5 --timeout=60 -c cmd arg",
                      canonical)
示例#23
0
 def test_harold_default(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertTrue(args.notify_harold)
示例#24
0
 def test_multiple_commands(self):
     args = parse_args(self.config,
                       ["-h", "host", "-c", "cmd1", "-c", "cmd2"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual("-h host --parallel=5 --timeout=60 -c cmd1 -c cmd2",
                      canonical)
示例#25
0
 def test_verbose_default(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertFalse(args.verbose_logging)
示例#26
0
 def test_verbose(self):
     args = parse_args(self.config, ["-h", "host", "-v"])
     canonical = construct_canonical_commandline(self.config, args)
     self.assertEqual("-h host --parallel=5 --timeout=60 --verbose",
                      canonical)
示例#27
0
 def test_dangerously_fast_default(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertFalse(args.dangerously_fast)
示例#28
0
 def test_host_list(self):
     args = parse_args(self.config, ["-h", "a", "b", "c"])
     self.assertEqual(args.host_refs, ["a", "b", "c"])
示例#29
0
 def test_empty_deploys(self):
     args = parse_args(self.config, ["-h", "a"])
     self.assertEqual(args.components, [])
示例#30
0
 def test_multiple_deploys(self):
     args = parse_args(self.config,
                       ["-h", "a", "-d", "comp", "-d", "comp2"])
     self.assertEqual(args.components, ["comp", "comp2"])