Example #1
0
def run_server(config_file):
    config.load(os.path.join(TEST_DIR, config_file))
    s = server.Server()
    s.start(config)
    try:
        yield s
    finally:
        s.stop()
Example #2
0
def run_server(config_file):
    config.load(os.path.join(TEST_DIR, config_file))
    s = server.Server()
    s.start(config)
    try:
        yield s
    finally:
        s.stop()
Example #3
0
def proxy_server():
    """
    Run proxy server during the test.
    """
    config.load(os.path.join(TEST_DIR, "resources/test_config.ini"))
    server_instance = server.Server()
    server_instance.start(config)
    try:
        yield config
    finally:
        server_instance.stop()
Example #4
0
def proxy_server():
    """
    Run proxy server during the test.
    """
    config.load(os.path.join(TEST_DIR, "proxy.conf"))
    server_instance = server.Server()
    server_instance.start(config)
    try:
        # During testing we use port 0 to get a random port.
        config.port = server_instance.port
        yield config
    finally:
        server_instance.stop()
Example #5
0
def proxy_server(request):
    logging.basicConfig(
        filename="/dev/stdout",
        level=logging.DEBUG,
        format="(%(threadName)-10s) %(levelname)s %(name)s:%(message)s")

    # Use a custom test configuration for the server; pki paths must be updated
    from ovirt_imageio_proxy import config
    config.load(CONFIG_FILE)
    config._set('engine_cert_file',
                os.path.join(TEST_DIR, "pki/certs/public_cert.pem"))
    config._set('engine_ca_cert_file',
                os.path.join(TEST_DIR, "pki/certs/public_cert.pem"))
    config._set('ssl_key_file', os.path.join(TEST_DIR, "pki/keys/vdsmkey.pem"))
    config._set('ssl_cert_file',
                os.path.join(TEST_DIR, "pki/certs/vdsmcert.pem"))

    server_instance = server.Server()
    server_instance.start(config)
    request.addfinalizer(server_instance.stop)

    return config