• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python nodepoolcmd.main函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_image_update_all

 def test_image_update_all(self):
     configfile = self.setup_config("node_cmd.yaml")
     self._useBuilder(configfile)
     self.patch_argv("-c", configfile, "image-update",
                     "all", "fake-image1")
     nodepoolcmd.main()
     self.assert_images_listed(configfile, 1)
开发者ID:no2a,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例2: test_delete_now

    def test_delete_now(self):
        configfile = self.setup_config('node.yaml')
        pool = self.useNodepool(configfile, watermark_sleep=1)
        self.useBuilder(configfile)

        # (Shrews): This is a hack to avoid a race with the DeletedNodeWorker
        # thread where it may see that our direct call to NodeDeleter.delete()
        # has changed the node state to DELETING and lock the node during the
        # act of deletion, but *after* the lock znode child has been deleted
        # and *before* kazoo has fully removed the node znode itself. This race
        # causes the rare kazoo.exceptions.NotEmptyError in this test because
        # a new lock znode gets created (that the original delete does not see)
        # preventing the node znode from being deleted.
        pool.delete_interval = 5

        pool.start()
        self.waitForImage('fake-provider', 'fake-image')
        nodes = self.waitForNodes('fake-label')
        self.assertEqual(len(nodes), 1)

        # Assert one node exists and it is node 1 in a ready state.
        self.assert_listed(configfile, ['list'], 0, nodes[0].id, 1)
        self.assert_nodes_listed(configfile, 1, zk.READY)

        # Delete node
        self.patch_argv('-c', configfile, 'delete', '--now', nodes[0].id)
        nodepoolcmd.main()
        self.waitForNodeDeletion(nodes[0])

        # Assert the node is gone
        self.assert_listed(configfile, ['list'], 0, nodes[0].id, 0)
开发者ID:jerryz1982,项目名称:nodepool,代码行数:31,代码来源:test_commands.py


示例3: test_dib_image_update

 def test_dib_image_update(self):
     configfile = self.setup_config("node_dib.yaml")
     self._useBuilder(configfile)
     self.patch_argv("-c", configfile, "image-update",
                     "fake-dib-provider", "fake-dib-image")
     nodepoolcmd.main()
     self.assert_images_listed(configfile, 1)
开发者ID:no2a,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例4: test_image_build

    def test_image_build(self):
        configfile = self.setup_config('node_dib.yaml')
        self._useBuilder(configfile)

        self.patch_argv("-c", configfile, "image-build", "fake-dib-diskimage")
        nodepoolcmd.main()
        self.assert_listed(configfile, ['dib-image-list'], 4, 'ready', 1)
开发者ID:no2a,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例5: test_alien_image_list_empty

 def test_alien_image_list_empty(self):
     configfile = self.setup_config("node.yaml")
     self.useBuilder(configfile)
     self.waitForImage('fake-provider', 'fake-image')
     self.patch_argv("-c", configfile, "alien-image-list")
     nodepoolcmd.main()
     self.assert_alien_images_empty(configfile)
开发者ID:jerryz1982,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例6: test_dib_image_build_pause

 def test_dib_image_build_pause(self):
     configfile = self.setup_config('node_diskimage_pause.yaml')
     self.useBuilder(configfile)
     self.patch_argv("-c", configfile, "image-build", "fake-image")
     with testtools.ExpectedException(Exception):
         nodepoolcmd.main()
     self.assert_listed(configfile, ['dib-image-list'], 1, 'fake-image', 0)
开发者ID:jerryz1982,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例7: test_dib_snapshot_image_update_all

 def test_dib_snapshot_image_update_all(self):
     configfile = self.setup_config("node_dib_and_snap.yaml")
     self.patch_argv("-c", configfile, "image-update",
                     "all", "fake-dib-image")
     nodepoolcmd.main()
     self.wait_for_threads()
     self.assert_images_listed(configfile, 2)
开发者ID:jianghuaw,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例8: test_snapshot_image_update

 def test_snapshot_image_update(self):
     configfile = self.setup_config("node.yaml")
     self.patch_argv("-c", configfile, "image-update",
                     "fake-provider", "fake-image")
     nodepoolcmd.main()
     self.wait_for_threads()
     self.assert_images_listed(configfile, 1)
开发者ID:jianghuaw,项目名称:nodepool,代码行数:7,代码来源:test_commands.py


示例9: test_image_delete_invalid

 def test_image_delete_invalid(self):
     configfile = self.setup_config("node_cmd.yaml")
     self.patch_argv("-c", configfile, "image-delete",
                     "--provider", "invalid-provider",
                     "--image", "invalid-image",
                     "--build-id", "invalid-build-id",
                     "--upload-id", "invalid-upload-id")
     nodepoolcmd.main()
开发者ID:jerryz1982,项目名称:nodepool,代码行数:8,代码来源:test_commands.py


示例10: test_job_delete

 def test_job_delete(self):
     configfile = self.setup_config('node.yaml')
     self.patch_argv("-c", configfile, "job-create", "fake-job",
                     "--hold-on-failure", "1")
     nodepoolcmd.main()
     self.assert_listed(configfile, ['job-list'], 2, 1, 1)
     self.patch_argv("-c", configfile, "job-delete", "1")
     nodepoolcmd.main()
     self.assert_listed(configfile, ['job-list'], 0, 1, 0)
开发者ID:Tesora,项目名称:tesora-nodepool,代码行数:9,代码来源:test_commands.py


示例11: test_dib_snapshot_image_update

 def test_dib_snapshot_image_update(self):
     configfile = self.setup_config("node_dib_and_snap.yaml")
     self.patch_argv("-c", configfile, "image-update",
                     "fake-provider1", "fake-dib-image")
     nodepoolcmd.main()
     self.patch_argv("-c", configfile, "image-update",
                     "fake-provider2", "fake-dib-image")
     nodepoolcmd.main()
     self.assert_images_listed(configfile, 2)
开发者ID:citrix-openstack,项目名称:nodepool,代码行数:9,代码来源:test_commands.py


示例12: test_alien_image_list_fail

    def test_alien_image_list_fail(self):
        def fail_list(self):
            raise RuntimeError('Fake list error')
        self.useFixture(fixtures.MonkeyPatch('nodepool.fakeprovider.FakeList'
                                             '.list', fail_list))

        configfile = self.setup_config("node_cmd.yaml")
        self.patch_argv("-c", configfile, "alien-image-list")
        nodepoolcmd.main()
开发者ID:citrix-openstack,项目名称:nodepool,代码行数:9,代码来源:test_commands.py


示例13: assert_listed

 def assert_listed(self, configfile, cmd, col, val, count):
     self.patch_argv("-c", configfile, *cmd)
     with mock.patch('prettytable.PrettyTable.add_row') as m_add_row:
         nodepoolcmd.main()
         rows_with_val = 0
         # Find add_rows with the status were looking for
         for args, kwargs in m_add_row.call_args_list:
             row = args[0]
             if row[col] == val:
                 rows_with_val += 1
         self.assertEquals(rows_with_val, count)
开发者ID:no2a,项目名称:nodepool,代码行数:11,代码来源:test_commands.py


示例14: assert_images_listed

 def assert_images_listed(self, configfile, image_cnt, status="ready"):
     self.patch_argv("-c", configfile, "image-list")
     with mock.patch('prettytable.PrettyTable.add_row') as m_add_row:
         nodepoolcmd.main()
         images_with_status = 0
         # Find add_rows with the status were looking for
         for args, kwargs in m_add_row.call_args_list:
             row = args[0]
             status_column = 7
             if row[status_column] == status:
                 images_with_status += 1
         self.assertEquals(images_with_status, image_cnt)
开发者ID:jianghuaw,项目名称:nodepool,代码行数:12,代码来源:test_commands.py


示例15: test_image_delete

 def test_image_delete(self):
     configfile = self.setup_config("node.yaml")
     self.useBuilder(configfile)
     self.waitForImage('fake-provider', 'fake-image')
     image = self.zk.getMostRecentImageUpload('fake-image', 'fake-provider')
     self.patch_argv("-c", configfile, "image-delete",
                     "--provider", "fake-provider",
                     "--image", "fake-image",
                     "--build-id", image.build_id,
                     "--upload-id", image.id)
     nodepoolcmd.main()
     self.waitForUploadRecordDeletion('fake-provider', 'fake-image',
                                      image.build_id, image.id)
开发者ID:jerryz1982,项目名称:nodepool,代码行数:13,代码来源:test_commands.py


示例16: test_dib_image_delete

 def test_dib_image_delete(self):
     configfile = self.setup_config('node_dib.yaml')
     pool = self.useNodepool(configfile, watermark_sleep=1)
     pool.start()
     self.waitForImage(pool, 'fake-dib-provider', 'fake-dib-image')
     self.waitForNodes(pool)
     # Check the image exists
     self.assert_listed(configfile, ['dib-image-list'], 0, 1, 1)
     self.assert_listed(configfile, ['dib-image-list'], 4, 'ready', 1)
     # Delete the image
     self.patch_argv('-c', configfile, 'dib-image-delete', '1')
     nodepoolcmd.main()
     # Check the the image is no longer listed
     self.assert_listed(configfile, ['dib-image-list'], 0, 1, 0)
开发者ID:citrix-openstack,项目名称:nodepool,代码行数:14,代码来源:test_commands.py


示例17: test_delete_now

 def test_delete_now(self):
     configfile = self.setup_config('node.yaml')
     pool = self.useNodepool(configfile, watermark_sleep=1)
     pool.start()
     self.waitForImage(pool, 'fake-provider', 'fake-image')
     self.waitForNodes(pool)
     # Assert one node exists and it is node 1 in a ready state.
     self.assert_listed(configfile, ['list'], 0, 1, 1)
     self.assert_nodes_listed(configfile, 1, 'ready')
     # Delete node 1
     self.patch_argv('-c', configfile, 'delete', '--now', '1')
     nodepoolcmd.main()
     # Assert the node is gone
     self.assert_listed(configfile, ['list'], 0, 1, 0)
开发者ID:no2a,项目名称:nodepool,代码行数:14,代码来源:test_commands.py


示例18: test_image_delete_snapshot

    def test_image_delete_snapshot(self):
        configfile = self.setup_config("node_cmd.yaml")
        self.patch_argv("-c", configfile, "image-update",
                        "all", "fake-image1")
        nodepoolcmd.main()
        pool = self.useNodepool(configfile, watermark_sleep=1)
        # This gives us a nodepool with a working db but not running which
        # is important so we can control image building
        pool.updateConfig()
        self.waitForImage(pool, 'fake-provider1', 'fake-image1')

        self.patch_argv("-c", configfile, "image-delete", '1')
        nodepoolcmd.main()
        self.assert_images_listed(configfile, 0)
开发者ID:no2a,项目名称:nodepool,代码行数:14,代码来源:test_commands.py


示例19: assert_listed

 def assert_listed(self, configfile, cmd, col, val, count, col_count=0):
     log = logging.getLogger("tests.PrettyTableMock")
     self.patch_argv("-c", configfile, *cmd)
     with mock.patch('prettytable.PrettyTable.add_row') as m_add_row:
         nodepoolcmd.main()
         rows_with_val = 0
         # Find add_rows with the status were looking for
         for args, kwargs in m_add_row.call_args_list:
             row = args[0]
             if col_count:
                 self.assertEquals(len(row), col_count)
             log.debug(row)
             if row[col] == val:
                 rows_with_val += 1
         self.assertEquals(rows_with_val, count)
开发者ID:jerryz1982,项目名称:nodepool,代码行数:15,代码来源:test_commands.py


示例20: test_image_build

    def test_image_build(self):
        configfile = self.setup_config('node.yaml')
        self.useBuilder(configfile)

        # wait for the scheduled build to arrive
        self.waitForImage('fake-provider', 'fake-image')
        self.assert_listed(configfile, ['dib-image-list'], 4, zk.READY, 1)
        image = self.zk.getMostRecentImageUpload('fake-image', 'fake-provider')

        # now do the manual build request
        self.patch_argv("-c", configfile, "image-build", "fake-image")
        nodepoolcmd.main()

        self.waitForImage('fake-provider', 'fake-image', [image])
        self.assert_listed(configfile, ['dib-image-list'], 4, zk.READY, 2)
开发者ID:jerryz1982,项目名称:nodepool,代码行数:15,代码来源:test_commands.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Node类代码示例发布时间:2022-05-27
下一篇:
Python nodeitems_utils.unregister_node_categories函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap