7
from deployer.env.go import GoEnvironment
12
# Takes roughly about 6m on core2 + ssd, mostly cloudinit time
14
(not bool(os.environ.get("TEST_ENDPOINT"))),
15
"Test env must be defined: TEST_ENDPOINT")
16
class LiveEnvironmentTest(Base):
19
self.endpoint = os.environ.get("TEST_ENDPOINT")
20
self.output = self.capture_logging(
21
"deployer", log_file=sys.stderr, level=logging.DEBUG)
22
self.env = GoEnvironment(
23
os.environ.get("JUJU_ENV"), self.endpoint)
25
self.assertFalse(self.env.status().get('services'))
26
# Destroy everything.. consistent baseline
27
self.env.reset(terminate_machines=True, terminate_delay=240)
30
self.env.reset(terminate_machines=True, terminate_delay=240)
34
status = self.env.status()
35
self.env.deploy("test-blog", "cs:precise/wordpress")
36
self.env.deploy("test-db", "cs:precise/mysql")
37
self.env.add_relation("test-db", "test-blog")
38
self.env.add_units('test-blog', 1)
40
# Sleep cause juju core watches are eventually consistent (5s window)
41
# and status rpc is broken (http://pad.lv/1203105)
43
self.env.wait_for_units(timeout=800)
44
status = self.env.status()
46
services = ["test-blog", "test-db"]
48
sorted(status['services'].keys()),
51
for k, u in status['services'][s]['units'].items():
52
self.assertEqual(u['agent-state'], "started")