Merge lp:~ack/landscape-charm/integration-tests-juju2 into lp:~landscape/landscape-charm/trunk

Proposed by Alberto Donato
Status: Merged
Approved by: Alberto Donato
Approved revision: 400
Merged at revision: 378
Proposed branch: lp:~ack/landscape-charm/integration-tests-juju2
Merge into: lp:~landscape/landscape-charm/trunk
Diff against target: 157 lines (+24/-32)
6 files modified
HACKING.md (+5/-5)
Makefile (+5/-13)
README.md (+5/-5)
dev/ubuntu-deps (+2/-2)
tests/helpers.py (+6/-6)
tests/test_helpers.py (+1/-1)
To merge this branch: bzr merge lp:~ack/landscape-charm/integration-tests-juju2
Reviewer Review Type Date Requested Status
Adam Collard (community) Approve
🤖 Landscape Builder test results Approve
Free Ekanayaka (community) Approve
Review via email: mp+317351@code.launchpad.net

Commit message

Update charm tests to support running them with juju2.

This uses bundletester instead of juju-test (which doesn't work with juju2).

Description of the change

Update charm tests to support running them with juju2.

This uses bundletester instead of juju-test (which doesn't work with juju2).

I created A temporary job for running them (and keep the juju1 running too) at https://ci.lscape.net/job/landscape-charm-test-2/

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 397
Branch: lp:~ack/landscape-charm/integration-tests-juju2
Jenkins: https://ci.lscape.net/job/latch-test-trusty/616/

review: Approve (test results)
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Nice, +1

review: Approve
Revision history for this message
Adam Collard (adam-collard) :
review: Needs Fixing
Revision history for this message
Alberto Donato (ack) :
398. By Alberto Donato

Fix juju2 terms.

399. By Alberto Donato

Fix juju2 terms.

400. By Alberto Donato

Don't set PYTHONPATH.

Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Fail
Revno: 400
Branch: lp:~ack/landscape-charm/integration-tests-juju2
Jenkins: https://ci.lscape.net/job/latch-test-trusty/630/

review: Needs Fixing (test results)
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 400
Branch: lp:~ack/landscape-charm/integration-tests-juju2
Jenkins: https://ci.lscape.net/job/latch-test-trusty/632/

review: Approve (test results)
Revision history for this message
Adam Collard (adam-collard) wrote :

+1 thanks for the fixes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'HACKING.md'
2--- HACKING.md 2016-06-29 07:35:10 +0000
3+++ HACKING.md 2017-02-16 10:25:24 +0000
4@@ -14,11 +14,11 @@
5
6 make integration-test
7
8-N.B., It will deploy into a real juju environment. It uses the juju-test
9-command to facilitate this, which takes care of bootstrapping for you. It
10-will use whatever 'juju env' reports as your current environment. It will use
11-a number of machines to do this test -- it should work on a local environment
12-(LXC), but could be quite resource intensive.
13+N.B., It will deploy into a the current juju model. It uses the bundletester
14+command to facilitate this. the `JUJU_MODEL` environment variable can be passed
15+to specify a different model. It will use a number of machines to do this test
16+-- it should work on a local controller (LXD), but could be quite resource
17+intensive.
18
19
20 Running parts of the integration tests
21
22=== modified file 'Makefile'
23--- Makefile 2017-01-11 13:57:59 +0000
24+++ Makefile 2017-02-16 10:25:24 +0000
25@@ -9,23 +9,15 @@
26 ./dev/ubuntu-deps
27 $(MAKE) test lint
28
29-verify-juju-test:
30- @echo "Checking for ... "
31- @echo -n "juju-test: "
32- @if [ -z `which juju-test` ]; then \
33- echo -e "\nRun ./dev/ubuntu-deps to get the juju-test command installed"; \
34- exit 1;\
35- else \
36- echo "installed"; \
37- fi
38-
39 update-charm-revision-numbers: bundles
40 @dev/update-charm-revision-numbers \
41 $(EXTRA_UPDATE_ARGUMENTS) \
42 apache2 postgresql juju-gui haproxy rabbitmq-server nfs
43
44-test-depends: verify-juju-test bundles
45- @cd tests && python3 test_helpers.py
46+test-depends: bundles
47+ pip install --user bundletester juju-deployer
48+ pip3 install --user amulet
49+ cd tests && python3 test_helpers.py
50
51 bundles-checkout:
52 @if [ -d bundles ]; then \
53@@ -53,7 +45,7 @@
54 fi
55
56 integration-test: test-depends
57- juju test --set-e -p LS_CHARM_SOURCE,JUJU_HOME,JUJU_ENV,PG_MANUAL_TUNING,DENSE_MAAS -v --timeout 7200s
58+ ~/.local/bin/bundletester -v -l DEBUG --skip-implicit -t .
59
60 # Run integration tests using the LDS package from the lds-trunk PPA
61 integration-test-trunk: secrets
62
63=== modified file 'README.md'
64--- README.md 2016-06-29 07:14:33 +0000
65+++ README.md 2017-02-16 10:25:24 +0000
66@@ -90,12 +90,12 @@
67 end-to-end integration testing. This is how you proceed with running
68 them:
69
70- # Make sure your JUJU_ENV is *not* bootstrapped, and:
71- $ JUJU_ENV=<env> make integration-test
72+ $ juju bootstrap localhost
73+ $ make integration-test
74
75 Or if you want to use the LDS packages from the lds-trunk PPA:
76
77- $ JUJU_ENV=<env> make integration-test-trunk
78+ $ JUJU_MODEL=<model> make integration-test-trunk
79
80-The JUJU_ENV environment variable can be omitted if you want to use the
81-current juju environment (as set by "juju switch").
82+The JUJU_MDOEL environment variable can be omitted if you want to use the
83+current model.
84
85=== modified file 'dev/ubuntu-deps'
86--- dev/ubuntu-deps 2016-10-28 12:58:21 +0000
87+++ dev/ubuntu-deps 2017-02-16 10:25:24 +0000
88@@ -10,9 +10,9 @@
89 # Add the juju stable ppa, install charm-tools (juju-test plugin) and other deps
90 sudo add-apt-repository -y ppa:juju/stable
91 sudo apt-get update
92-sudo apt-get -y install juju-deployer juju-core charm-tools python3 \
93+sudo apt-get -y install juju-2.0 charm-tools python3 \
94 python3-yaml curl python3-zope.testrunner \
95- python3-amulet python3-fixtures python3-jinja2 python3-fixtures\
96+ python3-amulet python3-fixtures python3-jinja2 python3-fixtures \
97 python3-psutil python3-twisted python3-flake8 \
98 python3-path python3-libcharmstore python3-zope.testrunner python3-six
99
100
101=== modified file 'tests/helpers.py'
102--- tests/helpers.py 2016-09-15 07:38:13 +0000
103+++ tests/helpers.py 2017-02-16 10:25:24 +0000
104@@ -60,7 +60,7 @@
105 """
106
107 _timeout = 3000
108- _series = "trusty"
109+ _series = "xenial"
110 _deployment = Deployment(series=_series)
111 _new_unit_target = None
112
113@@ -476,7 +476,7 @@
114
115 def _do_action(self, action, unit, action_params=None):
116 """Execute an action on a unit, returning the id."""
117- command = ["juju", "action", "do", "--format=json", unit, action]
118+ command = ["juju", "run-action", "--format=json", unit, action]
119 if action_params is not None:
120 sorted_action_params = sorted(
121 action_params.items(), key=itemgetter(0))
122@@ -490,8 +490,8 @@
123 def _fetch_action(self, action_id, wait=300):
124 """Fetch the results of an action."""
125 return json.loads(self._subprocess.check_output(
126- ["juju", "action", "fetch", "--format=json", "--wait", str(wait),
127- action_id]).decode("utf-8"))
128+ ["juju", "show-action-output", "--format=json", "--wait",
129+ str(wait), action_id]).decode("utf-8"))
130
131 def _get_charm_dir(self):
132 """Get the path to the root of the charm directory."""
133@@ -592,9 +592,9 @@
134 def _configure_for_dense_maas(self):
135 """Configure the deployment for a dense MAAS configuration.
136
137- All units will be placed in an LXC on the bootstrap node.
138+ All units will be placed in an LXD on the controller.
139 """
140- self._new_unit_target = "lxc:0"
141+ self._new_unit_target = "lxd:0"
142 services = [
143 service for service in DEFAULT_BUNDLE_CONTEXT.keys()
144 if service != "name"]
145
146=== modified file 'tests/test_helpers.py'
147--- tests/test_helpers.py 2016-09-15 07:38:13 +0000
148+++ tests/test_helpers.py 2017-02-16 10:25:24 +0000
149@@ -99,7 +99,7 @@
150 self.assertEqual(3000, self.deployment.timeout)
151 self.assertEqual(3000, self.deployment.sentry.timeout)
152 config = self.deployment.services["landscape-server"]
153- self.assertEqual("local:trusty/landscape-server", config["charm"])
154+ self.assertEqual("local:xenial/landscape-server", config["charm"])
155 self.assertTrue(os.environ["JUJU_REPOSITORY"].startswith("/tmp"))
156
157 def test_get_haproxy_public_address(self):

Subscribers

People subscribed via source and target branches