Merge lp:~uros-jovanovic/charms/trusty/juju-gui/hackingreview into lp:~juju-gui/charms/trusty/juju-gui/trunk

Proposed by Uros Jovanovic
Status: Merged
Merged at revision: 187
Proposed branch: lp:~uros-jovanovic/charms/trusty/juju-gui/hackingreview
Merge into: lp:~juju-gui/charms/trusty/juju-gui/trunk
Diff against target: 102 lines (+30/-8)
4 files modified
HACKING.md (+17/-4)
Makefile (+1/-2)
tests/20-functional.test (+12/-1)
tests/deploy.py (+0/-1)
To merge this branch: bzr merge lp:~uros-jovanovic/charms/trusty/juju-gui/hackingreview
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+226270@code.launchpad.net

Description of the change

enables ftests on local env

Create local environment (with "local" also being the name of that environment) and ftests can be now be run local as well.

https://codereview.appspot.com/113720043/

To post a comment you must log in.
188. By Uros Jovanovic

enable local to skip the --to 0 param

Revision history for this message
Uros Jovanovic (uros-jovanovic) wrote :

Reviewers: mp+226270_code.launchpad.net,

Message:
Please take a look.

Description:
minor change in hacking.md

https://code.launchpad.net/~uros-jovanovic/charms/trusty/juju-gui/hackingreview/+merge/226270

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/113720043/

Affected files (+12, -6 lines):
   M HACKING.md
   A [revision details]
   M tests/20-functional.test
   M tests/deploy.py

Index: HACKING.md
=== modified file 'HACKING.md'
--- HACKING.md 2014-04-22 10:28:39 +0000
+++ HACKING.md 2014-07-10 10:24:19 +0000
@@ -140,10 +140,10 @@
  When something goes wrong, on your local machine run
  `juju debug-hooks juju-gui/0` or similar. This will initially put you on
the
  unit that has the problem. You can look at what is going on in
-`/var/lib/juju/units/[NAME OF UNIT]`. There is a charm.log file to
-investigate, and a charm directory which contains the charm. The charm
-directory contains the `juju-gui` and `juju` directories, so everything you
-need is there.
+`/var/lib/juju/agents/[NAME OF UNIT]` (or instead of agents use
`containers`
+in the local environment. There is a charm.log file to investigate, and a
+charm directory which contains the charm. The charm directory contains the
+`juju-gui` and `juju` directories, so everything you need is there.

  If juju recognized an error (for instance, the unit is in
an "install-error"
  state) then you can do more. In another terminal on your local machine,
run

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: tests/20-functional.test
=== modified file 'tests/20-functional.test'
--- tests/20-functional.test 2014-04-14 17:00:09 +0000
+++ tests/20-functional.test 2014-07-10 11:53:35 +0000
@@ -23,6 +23,7 @@
  import unittest
  import urllib2
  import urlparse
+import os

  from selenium.webdriver import Firefox
  from selenium.webdriver.support import ui
@@ -50,6 +51,10 @@
      print(err)
  bootstrap_node_series = juju_status()['machines']['0']['series']

+forced_machine = 0
+env_par = os.getenv('JUJU_ENV')
+if env_par == "local":
+ forced_machine = None

  def juju_deploy_gui(options=None):
      """Deploy the Juju GUI charm with the given options.
@@ -62,7 +67,7 @@
      service_name = make_service_name(prefix='juju-gui-')
      unit_info = juju_deploy(
          'juju-gui', service_name=service_name, options=options,
- force_machine=0, series=bootstrap_node_series)
+ force_machine=forced_machine, series=bootstrap_node_series)
      return service_name, unit_info

Index: tests/deploy.py
=== modified file 'tests/deploy.py'
--- tests/deploy.py 2014-04-22 09:27:01 +0000
+++ tests/deploy.py 2014-07-10 11:53:35 +0000
@@ -32,7 +32,6 @@
      wait_for_unit,
  )

-
  rsync = command('rsync', '-a',
                  '--exclude', '.git',
                  '--exclude', '.bzr',

189. By Uros Jovanovic

added flag to select the local environment

Revision history for this message
Uros Jovanovic (uros-jovanovic) wrote :
Revision history for this message
Richard Harding (rharding) wrote :

Couple of comments, will let Jay do the final looks good approval based
on successful lxc and ec2 test runs.

https://codereview.appspot.com/113720043/diff/20001/HACKING.md
File HACKING.md (right):

https://codereview.appspot.com/113720043/diff/20001/HACKING.md#newcode107
HACKING.md:107: make ftest JUJU_ENV="myenv" JUJU_ENV_TYPE="local"
The doc is about colocation. Should this be a COLO=false flag instead?

https://codereview.appspot.com/113720043/diff/20001/Makefile
File Makefile (right):

https://codereview.appspot.com/113720043/diff/20001/Makefile#newcode20
Makefile:20: rsync xvfb firefox charm-tools
why is firefox the requirement? Are we not able to assume a browser and
let the dev select?

https://codereview.appspot.com/113720043/

190. By Uros Jovanovic

as juju-test do not pass parameters, we need to rely on the name of the environment for local deploy

Revision history for this message
Uros Jovanovic (uros-jovanovic) wrote :
Revision history for this message
Jay R. Wren (evarlast) wrote :

nits:
line 55 in tests/20... comment refers to JUJU_ENV_TYPE instead of
JUJU_ENV
i don't feel the whitespace change in tests/deploy.py is necessary

https://codereview.appspot.com/113720043/

191. By Uros Jovanovic

corrected description for JUJU_ENV

Revision history for this message
Uros Jovanovic (uros-jovanovic) wrote :
Revision history for this message
Jay R. Wren (evarlast) wrote :
Revision history for this message
Uros Jovanovic (uros-jovanovic) wrote :

*** Submitted:

enables ftests on local env

Create local environment (with "local" also being the name of that
environment) and ftests can be now be run local as well.

R=rharding, jay.wren
CC=
https://codereview.appspot.com/113720043

https://codereview.appspot.com/113720043/

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 2014-07-09 18:38:56 +0000
3+++ HACKING.md 2014-07-10 18:59:52 +0000
4@@ -103,6 +103,19 @@
5 `~/.juju/environments.yaml`, that will be bootstrapped before running the
6 tests and destroyed at the end of the test run.
7
8+To run a test on a local environment, create an environment named "local"
9+and type "local" like this:
10+
11+environments.yaml
12+
13+environments:
14+ local:
15+ type: local
16+
17+Then run:
18+
19+ make ftest JUJU_ENV="local"
20+
21 ## Running the Charm From Development ##
22
23 If you have set up your environment to run your local development charm,
24@@ -142,10 +155,10 @@
25 When something goes wrong, on your local machine run
26 `juju debug-hooks juju-gui/0` or similar. This will initially put you on the
27 unit that has the problem. You can look at what is going on in
28-`/var/lib/juju/units/[NAME OF UNIT]`. There is a charm.log file to
29-investigate, and a charm directory which contains the charm. The charm
30-directory contains the `juju-gui` and `juju` directories, so everything you
31-need is there.
32+`/var/lib/juju/agents/[NAME OF UNIT]` (or instead of agents use `containers`
33+in the local environment. There is a charm.log file to investigate, and a
34+charm directory which contains the charm. The charm directory contains the
35+`juju-gui` and `juju` directories, so everything you need is there.
36
37 If juju recognized an error (for instance, the unit is in an "install-error"
38 state) then you can do more. In another terminal on your local machine, run
39
40=== modified file 'Makefile'
41--- Makefile 2014-04-22 09:27:01 +0000
42+++ Makefile 2014-07-10 18:59:52 +0000
43@@ -17,8 +17,7 @@
44 JUJUTEST = yes | juju-test --timeout=60m -v -e "$(JUJU_ENV)"
45 VENV = tests/.venv
46 SYSDEPS = build-essential bzr libapt-pkg-dev libpython-dev python-virtualenv \
47- rsync xvfb
48-
49+ rsync xvfb charm-tools
50
51 all: setup
52
53
54=== modified file 'tests/20-functional.test'
55--- tests/20-functional.test 2014-04-14 17:00:09 +0000
56+++ tests/20-functional.test 2014-07-10 18:59:52 +0000
57@@ -23,6 +23,7 @@
58 import unittest
59 import urllib2
60 import urlparse
61+import os
62
63 from selenium.webdriver import Firefox
64 from selenium.webdriver.support import ui
65@@ -50,6 +51,16 @@
66 print(err)
67 bootstrap_node_series = juju_status()['machines']['0']['series']
68
69+"""
70+If JUJU_ENV is defined to local, then the --to is not
71+used as it is not needed in the local env. Otherwise, the
72+default placing of the deployed GUI charm is on machine 0
73+with a --to 0
74+"""
75+forced_machine = 0
76+env_par = os.getenv('JUJU_ENV')
77+if env_par == "local":
78+ forced_machine = None
79
80 def juju_deploy_gui(options=None):
81 """Deploy the Juju GUI charm with the given options.
82@@ -62,7 +73,7 @@
83 service_name = make_service_name(prefix='juju-gui-')
84 unit_info = juju_deploy(
85 'juju-gui', service_name=service_name, options=options,
86- force_machine=0, series=bootstrap_node_series)
87+ force_machine=forced_machine, series=bootstrap_node_series)
88 return service_name, unit_info
89
90
91
92=== modified file 'tests/deploy.py'
93--- tests/deploy.py 2014-04-22 09:27:01 +0000
94+++ tests/deploy.py 2014-07-10 18:59:52 +0000
95@@ -32,7 +32,6 @@
96 wait_for_unit,
97 )
98
99-
100 rsync = command('rsync', '-a',
101 '--exclude', '.git',
102 '--exclude', '.bzr',

Subscribers

People subscribed via source and target branches