~ajkavanagh/charms/trusty/memcached/add-spaces-support

« back to all changes in this revision

Viewing changes to tests/20_deploy_replication_test.py

  • Committer: Adam Israel
  • Date: 2016-03-02 22:25:40 UTC
  • mfrom: (70.1.2 memcached.lp1525026)
  • Revision ID: adam.israel@gmail.com-20160302222540-q0f4ks6ytwid7wmf
[freyes] Open firewall to allow non-related machines to connect: LP #287213

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
            o = line.split()[1]
15
15
            break
16
16
 
17
 
    if o != b.info['public-address']:
18
 
        amulet.raise_status(amulet.FAIL, msg='Incorrect replica address')
 
17
    priv_addr_b, code = b.run('unit-get private-address')
 
18
    assert code == 0, "unit-get private-address failed, code %s" % code
 
19
    if o != priv_addr_b:
 
20
        print('(%s != %s)' % (o, priv_addr_b))
 
21
        amulet.raise_status(amulet.FAIL, msg=('Incorrect replica address '
 
22
                                              '(%s != %s)') % (o, priv_addr_b))
19
23
 
20
24
 
21
25
def check_replication(a, b, port):
48
52
        message = 'An error occurred communicating with memcached over telnet'
49
53
        amulet.raise_status(amulet.FAIL, msg=message)
50
54
    finally:
51
 
        tn.close()
 
55
        try:
 
56
            tn.close()
 
57
        except NameError:
 
58
            pass
52
59
 
53
60
 
54
61
seconds = 1200
76
83
except:
77
84
    raise
78
85
 
79
 
units = (d.sentry['memcached/0'], d.sentry['memcached/1'])
 
86
units = (d.sentry['memcached'][0], d.sentry['memcached'][1])
80
87
memcached_port = configuration.get('tcp-port')
81
88
 
82
89
for memcached_unit in units:
84
91
    output, code = memcached_unit.run(command)
85
92
 
86
93
    # open memcache to be able to connect from this machine
87
 
    memcached_unit.run('ufw allow {}'.format(memcached_port))
 
94
    memcached_unit.run('ufw insert 1 allow {}'.format(memcached_port))
88
95
 
89
96
    if code != 0:
90
97
        message = 'The ' + command + ' returned %d.' % code