Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5088)

Issue 7306045: Add an option to start test server.

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by frankban
Modified:
11 years, 2 months ago
Reviewers:
mp+146639
Visibility:
Public.

Description

Add an option to start test server. Added the "serve-tests" option to the charm, defaulting to False. When the option is enabled it is possible to run the Juju GUI unit tests using https://[sevice url]/test/. I needed to conditionally add the corresponding location to the nginx configuration file. I discussed with Gary about possible ways to achieve this. Using the standard Python string substitution seemed hacky, and the resulting template file could be less readable. We decided to start using a templating library: ended up with tempita because it is lightweight and it is already used in maas. nginx is now configured so that the /test/ location: - serves unit tests if "serve-tests" is True; - redirects to / if "serve-tests" is False. The latter is required because otherwise the test location would be added to the browser appcache: the index.html file would be served and it references the manifest file. Also fixed dependency management in the install hook. Now all the Python libraries required by the charm are installed at the beginning of the process, before utils, launchpadlib, tempita etc. are imported. QA: - deploy the charm; - juju set juju-gui serve-tests=true; - go to "https://[sevice url]/test/"; - you should see tests run (mocha html reporter). Problems: test-debug (staging=true) fails to run because it attempts to load external (insecure) resources. Filed bug #1116320. https://code.launchpad.net/~frankban/charms/precise/juju-gui/bug-1110816-serve-tests/+merge/146639 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 7

Patch Set 2 : Add an option to start test server. #

Patch Set 3 : Add an option to start test server. #

Total comments: 4

Patch Set 4 : Add an option to start test server. #

Patch Set 5 : Add an option to start test server. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -53 lines) Patch
M HACKING.md View 1 chunk +1 line, -1 line 0 comments Download
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M config.yaml View 1 chunk +7 lines, -0 lines 0 comments Download
M config/config.js.template View 1 chunk +6 lines, -6 lines 0 comments Download
M config/haproxy.cfg.template View 2 chunks +5 lines, -5 lines 0 comments Download
M config/juju-api-agent.conf.template View 1 chunk +4 lines, -4 lines 0 comments Download
M config/juju-api-improv.conf.template View 1 chunk +4 lines, -4 lines 0 comments Download
M config/nginx-site.template View 1 1 chunk +17 lines, -5 lines 0 comments Download
M hooks/config-changed View 2 chunks +5 lines, -2 lines 0 comments Download
M hooks/install View 1 2 3 2 chunks +11 lines, -6 lines 0 comments Download
M hooks/start View 1 chunk +2 lines, -1 line 0 comments Download
M hooks/utils.py View 1 2 3 4 chunks +27 lines, -12 lines 0 comments Download
M revision View 1 chunk +1 line, -1 line 0 comments Download
M tests/test_utils.py View 1 2 3 6 chunks +9 lines, -6 lines 0 comments Download

Messages

Total messages: 11
frankban
Please take a look.
11 years, 2 months ago (2013-02-05 14:48:25 UTC) #1
gary.poster
Looks good to me. I'll try it now, and then report back. Thank you! Gary ...
11 years, 2 months ago (2013-02-05 15:19:52 UTC) #2
frankban
Please take a look. https://codereview.appspot.com/7306045/diff/1/config/nginx-site.template File config/nginx-site.template (right): https://codereview.appspot.com/7306045/diff/1/config/nginx-site.template#newcode27 config/nginx-site.template:27: # automatically added to the ...
11 years, 2 months ago (2013-02-05 16:10:34 UTC) #3
gary.poster
On 2013/02/05 16:10:34, frankban wrote: > On 2013/02/05 15:19:52, gary.poster wrote: ... > https://codereview.appspot.com/7306045/diff/1/hooks/utils.py#newcode239 > ...
11 years, 2 months ago (2013-02-05 16:19:00 UTC) #4
gary.poster
Land as is or with changes as suggested. The QA worked for me! I initially ...
11 years, 2 months ago (2013-02-05 16:33:55 UTC) #5
frankban
Please take a look.
11 years, 2 months ago (2013-02-05 16:58:50 UTC) #6
teknico
Land with changes, see below. Also: is it appropriate that the test URL bypasses authentication? ...
11 years, 2 months ago (2013-02-05 17:26:29 UTC) #7
gary.poster
On 2013/02/05 17:26:29, teknico wrote: > Land with changes, see below. > > Also: is ...
11 years, 2 months ago (2013-02-05 18:57:57 UTC) #8
frankban
Please take a look. https://codereview.appspot.com/7306045/diff/8001/hooks/install File hooks/install (right): https://codereview.appspot.com/7306045/diff/8001/hooks/install#newcode21 hooks/install:21: # of python-charmhelpers. On 2013/02/05 ...
11 years, 2 months ago (2013-02-06 09:23:52 UTC) #9
frankban
On 2013/02/05 18:57:57, gary.poster wrote: > On 2013/02/05 17:26:29, teknico wrote: > > Land with ...
11 years, 2 months ago (2013-02-06 11:55:35 UTC) #10
frankban
11 years, 2 months ago (2013-02-06 11:56:48 UTC) #11
*** Submitted:

Add an option to start test server.

Added the "serve-tests" option to the charm, 
defaulting to False. When the option is enabled 
it is possible to run the Juju GUI unit tests 
using https://[sevice url]/test/.

I needed to conditionally add the corresponding 
location to the nginx configuration file. 
I discussed with Gary about possible ways to 
achieve this. Using the standard Python string 
substitution seemed hacky, and the resulting 
template file could be less readable. We decided 
to start using a templating library: ended up with 
tempita because it is lightweight and it is already 
used in maas.

nginx is now configured so that the /test/ location:
- serves unit tests if "serve-tests" is True;
- redirects to / if "serve-tests" is False.
The latter is required because otherwise the test 
location would be added to the browser appcache: 
the index.html file would be served and it references 
the manifest file.

Also fixed dependency management in the install
hook. Now all the Python libraries required by the
charm are installed at the beginning of the process,
before utils, launchpadlib, tempita etc. are imported. 

QA:

- deploy the charm;
- juju set juju-gui serve-tests=true;
- go to "https://[sevice url]/test/";
- you should see tests run (mocha html reporter).

Problems:

test-debug (staging=true) fails to run because 
it attempts to load external (insecure) resources.
Filed bug #1116320.

R=gary.poster, teknico
CC=
https://codereview.appspot.com/7306045
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b