summaryrefslogtreecommitdiff
path: root/demoscript/IceDiscovery/replication.py
blob: 7c400fadf997d1b4e021262b651cb633f8ac8358 (plain)
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
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 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
import Expect

def runtests(client, serverCount):
    sys.stdout.write("testing " + str(serverCount) + " server(s)...")
    sys.stdout.flush()
    client.sendline('5')
    client.expect('.*enter the delay between each greetings \(in ms\):.*')
    client.sendline('50')
    if serverCount == 0:
        client.expect('.*NoEndpointException.*')
    else:
    	for i in range (0, 5):
    	    client.expect('Server. says Hello World!')
    print("ok")

def run(client, server1, server2, server3):
    runtests(client, 3)

    print("shutdown first server");
    server1.terminate()
    runtests(client, 2)

    print("shutdown second server");
    server2.terminate()
    runtests(client, 1)

    print("shutdown third server");
    server3.terminate()
    runtests(client, 0)

    client.terminate()