Пример #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"])