7
d = amulet.Deployment(series='trusty')
9
d.add('rabbitmq-server')
10
d.expose('rabbitmq-server')
12
# Don't forget to expose using d.expose(service)
15
# TODO(billy-olsen), juju test --timeout fails to pass the timeout values
16
# into the environment and the charm isn't the best of places to select
17
# a viable timeout since so muc is attributed to the environment anyways.
18
# Need to fix this the right way, but for now we'll bump the timeout.
21
except amulet.helpers.TimeoutError:
22
amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
26
server = d.sentry.unit['rabbitmq-server/0']
27
host = server.info['public-address']
30
# Connects without ssl
32
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host,
34
except Exception as e:
37
"Insecure connection failed with ssl=off: {}".format(str(e))
40
# Doesn't connect with ssl
42
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host,
44
except Exception as e:
49
'SSL enabled when it shouldn\'t.'
52
d.configure('rabbitmq-server', {
56
# There's a race for changing the configuration of a deployment.
57
# The configure from the juju client side happens fairly quickly, and the
58
# sentry.wait() can fire before the config-changed hooks do, which causes
63
# Connects without ssl
65
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host,
67
except Exception as e:
70
"Insecure connection fails with ssl=on: {}".format(str(e))
75
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host,
78
except Exception as e:
81
"Secure connection fails with ssl=on"
84
d.configure('rabbitmq-server', {
88
# There's a race for changing the configuration of a deployment.
89
# The configure from the juju client side happens fairly quickly, and the
90
# sentry.wait() can fire before the config-changed hooks do, which causes
96
# Doesn't connect without ssl
98
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host,
100
except Exception as e:
105
"Connects without SSL when it shouldn't"
110
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host,
113
except Exception as e:
116
"Secure connection fails with ssl=only: {}".format(str(e))