def get_servers_addrs(): # Get server addresses through Blockade parser = block.setup_parser() opts = parser.parse_args(args=["status"]) config = block.load_config(opts) b = block.get_blockade(config) containers = b.status() global servers for c in containers: servers.append((c.ip_address, 5000))
def get_servers_addrs(): # Get server addresses through Blockade parser = block.setup_parser() opts = parser.parse_args(args=["status"]) config = block.load_config(opts) b = block.get_blockade(config) containers = b.status() global servers global num_servers for c in containers: servers += c.ip_address servers += ":2181," num_servers += 1 servers.strip(",")
def test_noconfig(self): """load default config when no file is present""" config = cli.load_config() self.assertEqual(0, len(config.containers))
def test_custom_notfound(self): """load config from nonexistent custom path""" with self.assertRaisesRegexp(BlockadeError, "^Failed to load config"): cli.load_config("./custom-file.yaml")
def test_custom(self): """load config from custom path""" self._writeConfig("custom-file.yaml") config = cli.load_config("./custom-file.yaml") self.assertIn("zzz", config.containers)
def test_yaml(self): """load config from blockade.yaml""" self._writeConfig("blockade.yaml") config = cli.load_config() self.assertIn("zzz", config.containers)