Example #1
0
def main():
    p = None
    if len(sys.argv) == 2:
        binary = sys.argv[-1]
        p = subprocess.Popen(binary, stdout=devnull)
        print "Started process", p.pid
    time.sleep(1)
    port = int(open("hyrise_server.port").readlines()[0])
    assert port != 0

    try:
        test_urls(port)
        c = Connection(port=port)

        test_tx(c)
        test_sockets(port, p.pid)
        test_perf_flag(port)
        send_query_and_terminate_before_response(port)
        time.sleep(2)
        send_query_and_terminate_before_response(port)
        subprocess.check_output(["curl", "-s", "localhost:{0}/shutdown/".format(port)])
        c.close()
        print "=====> No errors <====="
    except Exception, e:
        if p:
            print "Error'd out: Terminating..."
            p.terminate()
        raise
Example #2
0
def main():
    p = None
    if len(sys.argv) == 2:
        binary = sys.argv[-1]
        p = subprocess.Popen(binary, stdout=devnull)
        print "Started process", p.pid
    time.sleep(1)
    port = int(open("hyrise_server.port").readlines()[0])
    assert port != 0

    try:
        test_urls(port)
        c = Connection(port=port)

        test_tx(c)
        test_sockets(port, p.pid)
        test_perf_flag(port)
        send_query_and_terminate_before_response(port)
        time.sleep(2)
        send_query_and_terminate_before_response(port)
        subprocess.check_output(
            ["curl", "-s", "localhost:{0}/shutdown/".format(port)])
        c.close()
        print "=====> No errors <====="
    except Exception, e:
        if p:
            print "Error'd out: Terminating..."
            p.terminate()
        raise
Example #3
0
def test_sockets(port, pid):
    i = get_num_sockets(pid)
    c = Connection(port=port)
    test_tx(c)
    assert i + 1 == get_num_sockets(pid)
    c2 = Connection(port=port)
    test_tx(c2)
    assert i + 2 == get_num_sockets(pid)
    c.close()
    c2.close()
Example #4
0
def test_sockets(port, pid):
    i = get_num_sockets(pid)
    c = Connection(port=port)
    test_tx(c)
    assert i + 1 == get_num_sockets(pid)
    c2 = Connection(port=port)
    test_tx(c2)
    assert i + 2 == get_num_sockets(pid)
    c.close()
    c2.close()
Example #5
0
def main():

    # clear test log dir
    logdir = "./test/log"
    if (os.path.exists(logdir)):
        shutil.rmtree(logdir)
    os.mkdir(logdir)
    # recreate dummy file
    open(logdir + "/dummy", 'a').close()

    p = None
    if len(sys.argv) == 2:
        binary = sys.argv[-1]
        myenv = os.environ.copy()
        myenv["HYRISE_DB_PATH"] = os.getcwd() + "/test/"
        p = subprocess.Popen([binary, "--port=0"], env=myenv, stdout=devnull)
        print "Started process", p.pid

    time.sleep(1)
    port = int(open("hyrise_server.port").readlines()[0])
    assert port != 0

    try:
        test_urls(port)
        c = Connection(port=port)

        test_tx(c)
        test_sockets(port, p.pid)
        test_perf_flag(port)
        send_query_and_terminate_before_response(port)
        time.sleep(2)
        send_query_and_terminate_before_response(port)
        subprocess.check_output(
            ["curl", "-s", "localhost:{0}/shutdown/".format(port)])
        c.close()
        print "=====> No errors <====="
    except Exception, e:
        if p:
            print "Error'd out: Terminating..."
            p.terminate()
        raise
Example #6
0
def main():

    # clear test log dir
    logdir = "./test/log"
    if (os.path.exists(logdir)):
        shutil.rmtree(logdir)
    os.mkdir(logdir)
    # recreate dummy file
    open(logdir+"/dummy", 'a').close()

    p = None
    if len(sys.argv) == 2:
        binary = sys.argv[-1]
        myenv = os.environ.copy()
        myenv["HYRISE_DB_PATH"] = os.getcwd() + "/test/"
        p = subprocess.Popen([binary, "--port=0"], env=myenv, stdout=devnull)
        print "Started process", p.pid

    time.sleep(1)
    port = int(open("hyrise_server.port").readlines()[0])
    assert port != 0

    try:
        test_urls(port)
        c = Connection(port=port)

        test_tx(c)
        test_sockets(port, p.pid)
        test_perf_flag(port)
        send_query_and_terminate_before_response(port)
        time.sleep(2)
        send_query_and_terminate_before_response(port)
        subprocess.check_output(["curl", "-s", "localhost:{0}/shutdown/".format(port)])
        c.close()
        print "=====> No errors <====="
    except Exception, e:
        if p:
            print "Error'd out: Terminating..."
            p.terminate()
        raise