~hudson-openstack/burrow/trunk

« back to all changes in this revision

Viewing changes to test/backend/test_http.py

  • Committer: Tarmac
  • Author(s): Eric Day
  • Date: 2011-08-10 07:28:01 UTC
  • mfrom: (16.3.24 backend-unittests)
  • Revision ID: tarmac-20110810072801-32ue4p8boiepxhjg
Pushed wait functionality down into backend, removed frontend tests since this is replaced with HTTP backend test now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
def kill_server():
36
36
    try:
37
 
        pid_file = open('server.pid', 'r')
 
37
        pid_file = open('TestHTTP.pid', 'r')
38
38
        pid = pid_file.read()
39
39
        pid_file.close()
40
40
        try:
43
43
            os.kill(int(pid), signal.SIGTERM)
44
44
        except OSError:
45
45
            pass
46
 
        os.unlink('server.pid')
 
46
        os.unlink('TestHTTP.pid')
47
47
    except IOError:
48
48
        pass
49
49
 
50
50
 
51
51
def start_server():
 
52
    kill_server()
52
53
    pid = os.fork()
53
54
    if pid == 0:
54
55
        try:
66
67
        server.frontends[0].default_ttl = 0
67
68
        server.run()
68
69
        os.exit(0)
69
 
    pid_file = open('server.pid', 'w')
 
70
    pid_file = open('TestHTTP.pid', 'w')
70
71
    pid_file.write(str(pid))
71
72
    pid_file.close()
 
73
    atexit.register(kill_server)
72
74
    time.sleep(1)
73
75
 
74
76
 
75
 
kill_server()
76
77
start_server()
77
 
atexit.register(kill_server)