コード例 #1
0
def VM_START(*names):
    """start a virtual machine

    This task starts a virtual machine.
    """
    if not names:
        raise fail("VM is not specified")
    vms = [VM.find(name) for name in names]
    for vm in vms:
        if vm.running():
            warn("VM is already running: {}", vm.name)
            continue
        vm.start()
コード例 #2
0
def VM_STOP(*names):
    """stop a virtual machine

    This task stops a running virtual machine.  Run this task without
    any arguments to stop all running VMs.
    """
    if names:
        vms = [VM.find(name) for name in names]
    else:
        vms = [vm for vm in VM.list() if vm.running()]
    for vm in vms:
        if not vm.running():
            warn("VM is not running: {}", vm.name)
            continue
        vm.stop()
コード例 #3
0
def VM_DELETE(*names):
    """delete a virtual machine

    This task deletes an existing virtual machine image.
    """
    if not names:
        raise fail("VM is not specified")
    vms = [VM.find(name) for name in names]
    for vm in vms:
        if vm.missing():
            warn("VM is not built: {}", vm.name)
            continue
        if vm.running():
            warn("VM is running: {}", vm.name)
            continue
        vm.delete()
コード例 #4
0
def VM_BUILD(*names):
    """build a virtual machine

    This task builds a virtual machine image from scratch.  This
    usually takes some time and may require the original ISO
    image and a product key of the operating system.

    Run this task without arguments to build images for all
    registered VMs.
    """
    if names:
        vms = [VM.find(name) for name in names]
    else:
        vms = [vm for vm in VM.list() if vm.missing()]
    for vm in vms:
        if not vm.missing():
            warn("VM is already built: {}", vm.name)
            continue
        vm.build()
コード例 #5
0
ファイル: check.py プロジェクト: sirex/htsql
def CHECK_ALL():
    """run regression tests for all supported backends

    This task runs HTSQL regression tests on all combinations of client
    and server platforms.
    """
    vms = [
        py26_vm, py27_vm, pgsql84_vm, pgsql90_vm, pgsql91_vm, mysql51_vm,
        oracle10g_vm, mssql2005_vm, mssql2008_vm
    ]
    for vm in vms:
        if vm.missing():
            warn("VM is not built: {}", vm.name)
    for vm in vms:
        if vm.running():
            vm.stop()
    errors = 0
    try:
        for client_vm in [py26_vm, py27_vm]:
            if client_vm.missing():
                continue
            client_vm.start()
            client_vm.run("~/bin/pip -q install"
                          " hg+http://bitbucket.org/prometheus/pbbt")
            sh("hg clone --ssh='ssh -F %s' . ssh://linux-vm/src/htsql" %
               (CTL_DIR + "/ssh_config"))
            errors += trial("hg update && python setup.py install",
                            "installing HTSQL under %s" % client_vm.name)
            errors += trial(
                "pbbt test/regress.yaml -E test/regress.py"
                " -q -S /all/sqlite", "testing sqlite backend")
            for server_vm, suite in [(pgsql84_vm, 'pgsql'),
                                     (pgsql90_vm, 'pgsql'),
                                     (pgsql91_vm, 'pgsql'),
                                     (mysql51_vm, 'mysql'),
                                     (oracle10g_vm, 'oracle'),
                                     (mssql2005_vm, 'mssql'),
                                     (mssql2008_vm, 'mssql')]:
                if server_vm.missing():
                    continue
                server_vm.start()
                username_key = "%s_USERNAME" % suite.upper()
                password_key = "%s_PASSWORD" % suite.upper()
                host_key = "%s_HOST" % suite.upper()
                port_key = "%s_PORT" % suite.upper()
                username_value = {
                    'pgsql': "postgres",
                    'mysql': "root",
                    'oracle': "system",
                    'mssql': "sa"
                }[suite]
                password_value = "admin"
                host_value = "10.0.2.2"
                port_value = 10000 + server_vm.port
                command = "pbbt test/regress.yaml -E test/regress.py" \
                          " -q -S /all/%s" \
                          " -D %s=%s -D %s=%s -D %s=%s -D %s=%s" \
                          % (suite, username_key, username_value,
                             password_key, password_value,
                             host_key, host_value, port_key, port_value)
                message = "testing %s backend against %s" \
                          % (suite, server_vm.name)
                errors += trial(command, message)
                server_vm.stop()
            errors += trial(
                "pbbt test/regress.yaml -E test/regress.py"
                " -q -S /all/routine", "testing htsql-ctl routines")
            client_vm.stop()
    except:
        for vm in vms:
            if vm.running():
                vm.stop()
        raise
    log()
    if errors:
        if errors == 1:
            warn("1 failed test")
        else:
            warn("{} failed tests", errors)
    else:
        log("`All tests passed`")