예제 #1
0
def start_server():
    fhqtest.print_header("Start fhq-server")
    global p_fhq_server
    wd = os.getcwd()
    print(wd)
    os.chdir(wd + "/..")
    p_fhq_server = subprocess.Popen(
        [wd + '/../fhq-server', '-wd', './ci/travis/data', 'start'])
    os.chdir(wd)

    wait_max = 20
    wait_i = 0
    result_check_port = False
    while wait_i < wait_max:
        wait_i = wait_i + 1
        time.sleep(1)
        result_check_port = fhqtest.check_port('127.0.0.1', 1234)
        if not result_check_port:
            print(" =====> " + str(wait_i) + ": port not available... ")
        else:
            break

    if not result_check_port:
        print("Port not available... failed")
        exit(-1)
    else:
        print("Port available... OK!")
예제 #2
0
def run_tests():
    fhqtest.print_header(" > > > " + TEST_NAME + ": begin ")
    fhqtest.print_bold("Request main admin page... ")
    r = requests.get(fhqtest.TEST_WEB_SERVER + 'admin/')
    if r.status_code != 200:
        fhqtest.log_err("Wrong status code expected 200, but got " +
                        str(r.status_code))
        exit(-1)
    fhqtest.log_ok("admin page success got")
예제 #3
0
def stop_server():
    fhqtest.print_header("Stop fhq-server")
    global p_fhq_server
    if p_fhq_server != None:
        print("Kill process " + str(p_fhq_server.pid))
        os.kill(p_fhq_server.pid, signal.SIGKILL)
예제 #4
0
tests_passed = False
tests = [
    libtestwebserver,
    libtestusers,
    libtestgames,
    libtestquests,
    libtestscoreboard,
    libtestpublicevents,
    libtestleaks,
    libtestknowledgebase,
    libtestserversettings,
    libteststats
]

try:
    fhqtest.print_header(" > > > TESTS: begin ")
    libtestfhq.start_server()
    fhqtest.init_enviroment()
    for t in tests:
        fhqtest.print_header(" > > > " + t.test_name + ": begin ")
        try:
            t.run_tests()
        except Exception as e:
            fhqtest.deinit_enviroment()
            fhqtest.throw_err("Some tests wrong")
            exit(-1)
        fhqtest.print_header(" > > > " + t.test_name + ": end ")
    tests_passed = True
finally:
    fhqtest.print_header(" > > > TESTS: end ")
    if tests_passed:
예제 #5
0
""" Run tests """

import sys
import fhqtest
import libtestfhq
import libtestwebserver
import libtestusers
import libteststats
import libtestquests
import libtestknowledgebase

TESTS_PASSED = False
TESTS = [libtestwebserver, libtestquests, libtestknowledgebase, libteststats]

try:
    fhqtest.print_header(" > > > TESTS: begin ")
    libtestfhq.start_server()
    fhqtest.init_enviroment()
    for t in TESTS:
        fhqtest.print_header(" > > > " + t.TEST_NAME + ": begin ")
        try:
            t.run_tests()
        except Exception as e:
            fhqtest.deinit_enviroment()
            fhqtest.throw_err("Some tests wrong")
            sys.exit(-1)
        fhqtest.print_header(" > > > " + t.TEST_NAME + ": end ")
    TESTS_PASSED = True
finally:
    fhqtest.print_header(" > > > TESTS: end ")
    if TESTS_PASSED: