当前位置: 首页>>代码示例>>Python>>正文


Python config.BlockadeConfig类代码示例

本文整理汇总了Python中blockade.config.BlockadeConfig的典型用法代码示例。如果您正苦于以下问题:Python BlockadeConfig类的具体用法?Python BlockadeConfig怎么用?Python BlockadeConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BlockadeConfig类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_parse_fail_2

 def test_parse_fail_2(self):
     containers = {
         "c1": {"ima": "image1", "command": "/bin/bash"},
         "c2": {"image": "image2", "links": ["c1"]}
     }
     d = dict(containers=containers)
     with self.assertRaises(BlockadeConfigError):
         BlockadeConfig.from_dict(d)
开发者ID:akramarev,项目名称:blockade,代码行数:8,代码来源:test_config.py

示例2: test_parse_with_start_delay_fail_nonnumeric

    def test_parse_with_start_delay_fail_nonnumeric(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "start_delay": "abc123"}
        }
        d = dict(containers=containers, network={})

        with self.assertRaisesRegexp(BlockadeConfigError, "start_delay"):
            BlockadeConfig.from_dict(d)
开发者ID:akramarev,项目名称:blockade,代码行数:9,代码来源:test_config.py

示例3: test_parse_with_start_delay_2

    def test_parse_with_start_delay_2(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "start_delay": 0.4}
        }
        d = dict(containers=containers, network={})

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.start_delay, 0.4)
开发者ID:akramarev,项目名称:blockade,代码行数:11,代码来源:test_config.py

示例4: test_parse_with_numeric_port

    def test_parse_with_numeric_port(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "expose": [10000]}
        }
        d = dict(containers=containers, network={})

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.expose_ports, [10000])
开发者ID:akramarev,项目名称:blockade,代码行数:11,代码来源:test_config.py

示例5: test_parse_with_publish_1

    def test_parse_with_publish_1(self):
        containers = {
            "c1": {"image": "image1", "ports": {8080: 80}, "expose": [80]}
        }
        d = dict(containers=containers, network={})

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.expose_ports, [80])
        self.assertEqual(c1.publish_ports, {'8080': '80'})
开发者ID:akramarev,项目名称:blockade,代码行数:11,代码来源:test_config.py

示例6: test_parse_with_env_1

    def test_parse_with_env_1(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "environment": {"HATS": 4, "JACKETS": "some"}}
        }
        d = dict(containers=containers, network={})

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.environment, {"HATS": "4", "JACKETS": "some"})
开发者ID:akramarev,项目名称:blockade,代码行数:11,代码来源:test_config.py

示例7: test_parse_with_multiple_cap_add

    def test_parse_with_multiple_cap_add(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "cap_add": ["NET_ADMIN", "MKNOD"]}
        }
        d = dict(containers=containers, network={})

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.cap_add, ["NET_ADMIN", "MKNOD"])
开发者ID:EvilMcJerkface,项目名称:blockade,代码行数:11,代码来源:test_config.py

示例8: test_parse_with_volumes_4

    def test_parse_with_volumes_4(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "volumes": {"/some/mount": None}}
        }
        network = {}
        d = dict(containers=containers, network=network)

        config = BlockadeConfig.from_dict(d)
        # default value should be there
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.volumes, {"/some/mount": "/some/mount"})
开发者ID:akramarev,项目名称:blockade,代码行数:13,代码来源:test_config.py

示例9: test_parse_2

    def test_parse_2(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash"}
        }
        network = {"flaky": "61%"}
        d = dict(containers=containers, network=network)

        config = BlockadeConfig.from_dict(d)
        # default value should be there
        self.assertIn("flaky", config.network)
        self.assertEqual(config.network['flaky'], "61%")
        # default value should be there
        self.assertIn("slow", config.network)
开发者ID:akramarev,项目名称:blockade,代码行数:13,代码来源:test_config.py

示例10: test_parse_with_name

    def test_parse_with_name(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash",
                   "container_name": "abc"}
        }
        network = {}
        d = dict(containers=containers, network=network)

        config = BlockadeConfig.from_dict(d)
        # default value should be there
        self.assertEqual(len(config.containers), 1)
        c1 = config.containers['c1']
        self.assertEqual(c1.container_name, "abc")
开发者ID:akramarev,项目名称:blockade,代码行数:13,代码来源:test_config.py

示例11: test_parse_1

    def test_parse_1(self):
        containers = {
            "c1": {"image": "image1", "command": "/bin/bash"},
            "c2": {"image": "image2", "links": ["c1"]}
        }
        d = dict(containers=containers)

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(len(config.containers), 2)
        self.assertEqual(config.containers["c1"].name, "c1")
        self.assertEqual(config.containers["c1"].image, "image1")
        self.assertEqual(config.containers["c1"].command, "/bin/bash")
        self.assertEqual(config.containers["c2"].name, "c2")
        self.assertEqual(config.containers["c2"].image, "image2")
开发者ID:akramarev,项目名称:blockade,代码行数:14,代码来源:test_config.py

示例12: test_parse_with_count_1

    def test_parse_with_count_1(self):
        containers = {
            "db": {"image": "image1", "command": "/bin/bash", "count": 2},
            "app": {"image": "image1", "command": "/bin/bash",
                    "container_name": "abc", "count": 3}
        }
        d = dict(containers=containers, network={})

        config = BlockadeConfig.from_dict(d)
        self.assertEqual(set(config.containers.keys()),
                         set(["db_1", "db_2", "app_1", "app_2", "app_3"]))
        self.assertEqual(config.containers["app_1"].container_name, "abc_1")
        self.assertEqual(config.containers["app_2"].container_name, "abc_2")
        self.assertEqual(config.containers["app_3"].container_name, "abc_3")
开发者ID:akramarev,项目名称:blockade,代码行数:14,代码来源:test_config.py

示例13: create

def create(name):
    if not request.headers['Content-Type'] == 'application/json':
        abort(415)

    if BlockadeManager.blockade_exists(name):
        return 'Blockade name already exists', 400

    # This will abort with a 400 if the JSON is bad
    data = request.get_json()
    config = BlockadeConfig.from_dict(data)
    BlockadeManager.store_config(name, config)

    b = BlockadeManager.get_blockade(name)
    containers = b.create()

    return '', 204
开发者ID:EvilMcJerkface,项目名称:blockade,代码行数:16,代码来源:rest.py


注:本文中的blockade.config.BlockadeConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。