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


Python utils.get_free_port函数代码示例

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


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

示例1: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port

    utils.patch_auth()
    host = '127.0.0.1'
    port = utils.get_free_port('http')
    ssl_port = utils.get_free_port('https')
    test_server = utils.run_server(host, port, ssl_port, test_mode=True)
开发者ID:archu-s,项目名称:kimchi-fvt,代码行数:8,代码来源:test_plugin.py

示例2: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port

    patch_auth(sudo=False)
    model = mockmodel.MockModel('/tmp/obj-store-test')
    host = '127.0.0.1'
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    test_server = run_server(host, port, ssl_port, test_mode=True, model=model)
开发者ID:FengYang,项目名称:kimchi,代码行数:9,代码来源:test_authorization.py

示例3: setup_server

def setup_server(environment='development'):
    global test_server, model, host, port, ssl_port

    patch_auth()
    host = '127.0.0.1'
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    test_server = run_server(host, port, ssl_port, test_mode=True,
                             environment=environment)
开发者ID:biancafc,项目名称:wok,代码行数:9,代码来源:test_exception.py

示例4: test_vm_livemigrate_persistent_API

    def test_vm_livemigrate_persistent_API(self):
        patch_auth()

        inst = model.Model(libvirt_uri='qemu:///system',
                           objstore_loc=self.tmp_store)

        host = '127.0.0.1'
        port = get_free_port('http')
        ssl_port = get_free_port('https')
        cherrypy_port = get_free_port('cherrypy_port')

        with RollbackContext() as rollback:
            test_server = run_server(host, port, ssl_port, test_mode=True,
                                     cherrypy_port=cherrypy_port, model=inst)
            rollback.prependDefer(test_server.stop)

            self.request = partial(request, host, ssl_port)

            self.create_vm_test()
            rollback.prependDefer(utils.rollback_wrapper, self.inst.vm_delete,
                                  u'test_vm_migrate')

            # removing cdrom because it is not shared storage and will make
            # the migration fail
            dev_list = self.inst.vmstorages_get_list('test_vm_migrate')
            self.inst.vmstorage_delete('test_vm_migrate',  dev_list[0])

            try:
                self.inst.vm_start('test_vm_migrate')
            except Exception, e:
                self.fail('Failed to start the vm, reason: %s' % e.message)

            migrate_url = "/plugins/kimchi/vms/%s/migrate" % 'test_vm_migrate'

            req = json.dumps({'remote_host': KIMCHI_LIVE_MIGRATION_TEST,
                             'user': 'root'})
            resp = self.request(migrate_url, req, 'POST')
            self.assertEquals(202, resp.status)
            task = json.loads(resp.read())
            wait_task(self._task_lookup, task['id'])
            task = json.loads(
                self.request(
                    '/plugins/kimchi/tasks/%s' % task['id'],
                    '{}'
                ).read()
            )
            self.assertEquals('finished', task['status'])

            try:
                remote_conn = self.get_remote_conn()
                rollback.prependDefer(remote_conn.close)
                remote_vm = remote_conn.lookupByName('test_vm_migrate')
                self.assertTrue(remote_vm.isPersistent())
                remote_vm.destroy()
                remote_vm.undefine()
            except Exception, e:
                self.fail('Migration test failed: %s' % e.message)
开发者ID:louis-cao,项目名称:kimchi,代码行数:57,代码来源:test_livemigration.py

示例5: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port

    utils.patch_auth()
    model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
    host = '127.0.0.1'
    port = utils.get_free_port('http')
    ssl_port = utils.get_free_port('https')
    test_server = utils.run_server(host, port, ssl_port, test_mode=True,
                                   model=model)
开发者ID:Gossing,项目名称:kimchi,代码行数:10,代码来源:test_plugin.py

示例6: setUp

 def setUp(self):
     global host, port, ssl_port, model, test_server
     cherrypy.request.headers = {'Accept': 'application/json'}
     model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
     patch_auth()
     port = get_free_port('http')
     ssl_port = get_free_port('https')
     host = '127.0.0.1'
     test_server = run_server(host, port, ssl_port, test_mode=True,
                              model=model)
开发者ID:EmperorBeezie,项目名称:kimchi,代码行数:10,代码来源:test_mockmodel.py

示例7: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port, cherrypy_port

    patch_auth()
    model = Model(None, "/tmp/obj-store-test")
    host = "127.0.0.1"
    port = get_free_port("http")
    ssl_port = get_free_port("https")
    cherrypy_port = get_free_port("cherrypy_port")
    test_server = run_server(host, port, ssl_port, test_mode=True, cherrypy_port=cherrypy_port, model=model)
开发者ID:melmorabity,项目名称:kimchi,代码行数:10,代码来源:test_model_storagevolume.py

示例8: setup_server

def setup_server(environment='development'):
    global test_server, model, host, port, ssl_port

    patch_auth()
    model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
    host = '127.0.0.1'
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    test_server = run_server(host, port, ssl_port, test_mode=True, model=model,
                             environment=environment)
开发者ID:marclaporte,项目名称:kimchi,代码行数:10,代码来源:test_exception.py

示例9: setUpModule

def setUpModule():
    global test_server, model, host, ssl_port, tmpfile

    patch_auth()
    tmpfile = tempfile.mktemp()
    model = MockModel(tmpfile)
    host = "127.0.0.1"
    port = get_free_port("http")
    ssl_port = get_free_port("https")
    cherrypy_port = get_free_port("cherrypy_port")
    test_server = run_server(host, port, ssl_port, test_mode=True, cherrypy_port=cherrypy_port, model=model)
开发者ID:scottp-dpaw,项目名称:kimchi,代码行数:11,代码来源:test_host.py

示例10: setUpModule

def setUpModule():
    global host, port, ssl_port, model, test_server, fake_iso
    cherrypy.request.headers = {"Accept": "application/json"}
    model = mockmodel.MockModel("/tmp/obj-store-test")
    patch_auth()
    port = get_free_port("http")
    ssl_port = get_free_port("https")
    host = "127.0.0.1"
    test_server = run_server(host, port, ssl_port, test_mode=True, model=model)
    fake_iso = "/tmp/fake.iso"
    open(fake_iso, "w").close()
开发者ID:sdnnfv,项目名称:kimchi,代码行数:11,代码来源:test_mockmodel.py

示例11: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port, cherrypy_port, tmpfile

    utils.patch_auth()
    tmpfile = tempfile.mktemp()
    host = '127.0.0.1'
    port = utils.get_free_port('http')
    ssl_port = utils.get_free_port('https')
    cherrypy_port = utils.get_free_port('cherrypy_port')
    test_server = utils.run_server(host, port, ssl_port, test_mode=True,
                                   cherrypy_port=cherrypy_port)
开发者ID:biancafc,项目名称:wok,代码行数:11,代码来源:test_server.py

示例12: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port, cherrypy_port

    patch_auth()
    model = Model(None, '/tmp/obj-store-test')
    host = '127.0.0.1'
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    cherrypy_port = get_free_port('cherrypy_port')
    test_server = run_server(host, port, ssl_port, test_mode=True,
                             cherrypy_port=cherrypy_port, model=model)
开发者ID:ramonmedeiros,项目名称:kimchi,代码行数:11,代码来源:test_model_storagepool.py

示例13: setUpModule

def setUpModule():
    global host, port, ssl_port, model, test_server, fake_iso
    cherrypy.request.headers = {'Accept': 'application/json'}
    model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
    patch_auth()
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    host = '127.0.0.1'
    test_server = run_server(host, port, ssl_port, test_mode=True,
                             model=model)
    fake_iso = '/tmp/fake.iso'
    open(fake_iso, 'w').close()
开发者ID:gouzongmei,项目名称:kimchi,代码行数:12,代码来源:test_mockmodel.py

示例14: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port

    patch_auth(sudo=False)
    model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
    host = '127.0.0.1'
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    test_server = run_server(host, port, ssl_port, test_mode=True, model=model)

    # Create fake ISO to do the tests
    construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
开发者ID:SkyWei,项目名称:kimchi,代码行数:12,代码来源:test_authorization.py

示例15: setUpModule

def setUpModule():
    global test_server, model, host, port, ssl_port, cherrypy_port

    patch_auth()
    model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
    host = '127.0.0.1'
    port = get_free_port('http')
    ssl_port = get_free_port('https')
    cherrypy_port = get_free_port('cherrypy_port')
    test_server = run_server(host, port, ssl_port, test_mode=True,
                             cherrypy_port=cherrypy_port, model=model)

    # Create fake ISO to do the tests
    iso_gen.construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
    iso_gen.construct_fake_iso("/var/lib/libvirt/images/fedora.iso", True,
                               "17", "fedora")
开发者ID:melmorabity,项目名称:kimchi,代码行数:16,代码来源:test_rest.py


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