~alejdg/ubuntu-repository-cache/bionic

« back to all changes in this revision

Viewing changes to tests/100-single_unit.simple

  • Committer: Christopher Glass
  • Date: 2017-04-03 14:11:24 UTC
  • mfrom: (228.2.11 fix-juju2-tests)
  • Revision ID: christopher.glass@canonical.com-20170403141124-7xqp1307k0szoda2
Merge lp:~fginther/cloudware/ubuntu-repository-cache-juju2-tests into lp:~cloudware/cloudware/ubuntu-repository-cache

Switch amulet tests to use juju2

[a=fginther] [r=tribaal, Odd_Bloke]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python3
2
2
 
3
3
import amulet
 
4
import logging
4
5
import requests
5
 
import logging
 
6
import os
6
7
 
 
8
# Fetch the charm location from CHARM_DIR because bundletester relocates the
 
9
# tests when executing
 
10
CHARM_DIR = os.environ.get("CHARM_DIR")
 
11
SERVICE = 'ubuntu-repository-cache'
7
12
TIMEOUT = (40 + 60) * 60
8
 
SERVICE = 'ubuntu-repository-cache'
9
13
 
10
14
 
11
15
def setup_logging():
19
23
    LOGGER.warn(''.join(('test: ', msg)))
20
24
 
21
25
 
22
 
d = amulet.Deployment(series='trusty')
 
26
d = amulet.Deployment(series='xenial')
23
27
 
24
 
d.add(SERVICE, units=1, constraints={'mem':'8G', 'root-disk':'20G'})
 
28
d.add(SERVICE, charm=CHARM_DIR,
 
29
      units=1, constraints={'mem':'8G', 'root-disk':'20G'})
25
30
d.expose(SERVICE)
26
31
 
27
32
# Hijack the logger from charm test
38
43
    raise
39
44
log('Start complete')
40
45
 
41
 
unit = d.sentry.unit[SERVICE + '/0']
 
46
# Test assumes that there is only one unit deployed
 
47
unit = d.sentry[SERVICE][0]
42
48
 
43
49
# test we can access metadata
44
50
page = requests.get('http://{}/ubuntu'.format(unit.info['public-address']))