Skip to content

Instantly share code, notes, and snippets.

Created March 21, 2016 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b252865ec752459f01f8 to your computer and use it in GitHub Desktop.
Save anonymous/b252865ec752459f01f8 to your computer and use it in GitHub Desktop.
10-deploy.py
#!/usr/bin/python3
import amulet
import unittest
class TestCharm(unittest.TestCase):
def setUp(self):
self.d = amulet.Deployment(series='trusty')
self.d.add('ubuntu', 'cs:trusty/ubuntu')
self.d.add('logstash', 'cs:~containers/trusty/logstash-2')
self.d.add('filebeat')
self.d.relate('filebeat:beats-host', 'ubuntu:juju-info')
self.d.relate('filebeat:logstash', 'logstash:filebeat')
self.d.setup(timeout=900)
self.d.sentry.wait()
self.unit = self.d.sentry['filebeat'][0]
def test_logstash_host_in_templating(self):
stash_address = self.unit.relation('logstash', 'logstash:filebeat')['private-address'] # noqa
remote = self.unit.file_contents('/etc/filebeat/filebeat.yml')
self.assertTrue(stash_address in remote)
if __name__ == "__main__":
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment