Exemplo n.º 1
0
    def test_instance_defaults(self):
        ctx = context.ctx()
        cluster = self._create_sample_cluster()
        cluster_id = cluster["id"]
        ng_id = cluster["node_groups"][-1]["id"]

        self.api.instance_add(ctx, ng_id, {"instance_name": "vm123"})

        cluster = self.api.cluster_get(ctx, cluster_id)
        ng = general.find_dict(cluster['node_groups'], id=ng_id)
        instance = general.find_dict(ng['instances'], instance_name="vm123")

        self._assert_props(instance, volumes=[])
Exemplo n.º 2
0
    def test_instance_defaults(self):
        ctx = context.ctx()
        cluster = self._create_sample_cluster()
        cluster_id = cluster["id"]
        ng_id = cluster["node_groups"][-1]["id"]

        self.api.instance_add(ctx, ng_id, {
            "instance_name": "vm123"
        })

        cluster = self.api.cluster_get(ctx, cluster_id)
        ng = general.find_dict(cluster['node_groups'], id=ng_id)
        instance = general.find_dict(ng['instances'], instance_name="vm123")

        self._assert_props(instance, volumes=[])
Exemplo n.º 3
0
    def test_find_dict(self):
        iterable = [{"a": 1}, {"a": 1, "b": 2, "c": 3}, {"a": 2}, {"c": 3}]

        self.assertEqual({
            "a": 1,
            "b": 2,
            "c": 3
        }, general.find_dict(iterable, a=1, b=2))
Exemplo n.º 4
0
    def test_find_dict(self):
        iterable = [
            {
                "a": 1
            },
            {
                "a": 1,
                "b": 2,
                "c": 3
            },
            {
                "a": 2
            },
            {
                "c": 3
            }
        ]

        self.assertEqual({"a": 1, "b": 2, "c": 3},
                         general.find_dict(iterable, a=1, b=2))