コード例 #1
0
ファイル: test_cluster_view.py プロジェクト: nl5887/LogDevice
 async def test_smoke(self):
     async with MockAdminAPI() as client:
         cv = await get_cluster_view(client)
         await apply_maintenance(
             client=client,
             shards=[
                 ShardID(node=cv.get_node_view_by_node_index(0).node_id,
                         shard_index=1)
             ],
             sequencer_nodes=[cv.get_node_view_by_node_index(0).node_id],
         )
         await apply_maintenance(
             client=client,
             node_ids=[cv.get_node_id(node_index=1)],
             user="******",
             reason="whatever",
         )
         (cv, nc_resp, ns_resp, mnts_resp) = await asyncio.gather(
             get_cluster_view(client),
             client.getNodesConfig(NodesFilter()),
             client.getNodesState(NodesStateRequest()),
             client.getMaintenances(MaintenancesFilter()),
         )
     self._validate(cv, nc_resp.nodes, ns_resp.states,
                    tuple(mnts_resp.maintenances))
コード例 #2
0
    async def smoke(self, client) -> None:
        cv = await get_cluster_view(client)
        storages_node_views = [
            nv for nv in cv.get_all_node_views() if nv.is_storage
        ]
        sequencers_node_views = [
            nv for nv in cv.get_all_node_views() if nv.is_sequencer
        ]

        # combined maintenance, storages and sequencers
        await apply_maintenance(
            client=client,
            shards=[
                ShardID(node=storages_node_views[0].node_id, shard_index=1)
            ],
            sequencer_nodes=[sequencers_node_views[0].node_id],
        )

        # storage-only maintenance
        await apply_maintenance(
            client=client,
            shards=[
                ShardID(node=storages_node_views[1].node_id, shard_index=1)
            ],
        )

        # sequencer-only maintenance
        await apply_maintenance(
            client=client, sequencer_nodes=[sequencers_node_views[2].node_id])

        # maintenance for whole nodes
        await apply_maintenance(
            client=client,
            node_ids=[
                storages_node_views[3].node_id,
                sequencers_node_views[4].node_id
            ],
            user="******",
            reason="whatever",
        )

        (cv, nc_resp, ns_resp, mnts_resp) = await asyncio.gather(
            get_cluster_view(client),
            client.getNodesConfig(NodesFilter()),
            client.getNodesState(NodesStateRequest()),
            client.getMaintenances(MaintenancesFilter()),
        )
        self._validate(cv, nc_resp.nodes, ns_resp.states,
                       tuple(mnts_resp.maintenances))