1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************
import sys, time, signal
import demoscript.Expect as Expect
def run(client, server, sessionserver, glacier2):
print "testing ",
sys.stdout.flush()
client.expect('user id:')
client.sendline("foo")
client.expect('password:')
client.sendline("foo")
sessionserver.expect('verified user')
sessionserver.expect('creating session')
client.expect("==>")
print "twoway",
sys.stdout.flush()
client.sendline('t')
server.expect('initiating callback to')
client.expect('received callback')
glacier2.expect('_fwd/t \\]')
print "oneway",
sys.stdout.flush()
client.sendline('o')
server.expect('initiating callback to')
client.expect('received callback')
glacier2.expect('_fwd/o \\]')
print "batch",
sys.stdout.flush()
client.sendline('O')
try:
server.expect('initiating callback to', timeout=1)
except Expect.TIMEOUT:
pass
client.sendline('O')
client.sendline('f')
glacier2.expect('_fwd/O \\]')
print "ok"
print "testing override context field...",
sys.stdout.flush()
client.sendline('v')
client.sendline('t')
server.expect('initiating callback to')
client.expect('received callback')
glacier2.expect('_fwd/t, _ovrd/some_value')
print "ok"
print "testing fake category...",
sys.stdout.flush()
client.sendline('v')
client.sendline('F')
client.sendline('t')
server.expect('initiating callback to.*fake.*ObjectNotExistException')
glacier2.expect('_fwd/t, _ovrd/some_value')
try:
client.expect('received callback', timeout=1)
except Expect.TIMEOUT:
pass
print "ok"
print "testing session timeout...",
sys.stdout.flush()
time.sleep(6)
glacier2.expect('expiring session')
sessionserver.expect('destroying session for user')
print "ok"
# SessionNotExist
client.sendline('x')
client.expect('SessionNotExistException')
client.waitTestSuccess()
sessionserver.kill(signal.SIGINT)
sessionserver.waitTestSuccess()
server.kill(signal.SIGINT)
server.waitTestSuccess()
glacier2.kill(signal.SIGINT)
glacier2.waitTestSuccess()
|