Merge lp:~frankban/charms/trusty/redis/tsting-fixes into lp:~juju-gui/charms/trusty/redis/trunk

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 5
Proposed branch: lp:~frankban/charms/trusty/redis/tsting-fixes
Merge into: lp:~juju-gui/charms/trusty/redis/trunk
Diff against target: 96 lines (+20/-14)
1 file modified
Makefile (+20/-14)
To merge this branch: bzr merge lp:~frankban/charms/trusty/redis/tsting-fixes
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+262062@code.launchpad.net

Description of the change

Makefile fixes for bundletester.

- The "local" env is no longer used by default when
  JUJU_ENV is not specified. Now the current env is
  used instead.

- The environment is no longer destroyed when ftests
  complete.

- Do not exit if bootstrap returns an error: assume
  the environment to be already bootstrapped.

- Removed the setup phony target to work around a
  bundletester bug.

For more info, see review comments at
https://bugs.launchpad.net/charms/+bug/1459345

https://codereview.appspot.com/248930043/

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :
Download full text (4.2 KiB)

Reviewers: mp+262062_code.launchpad.net,

Message:
Please take a look.

Description:
Makefile fixes for bundletester.

- The "local" env is no longer used by default when
   JUJU_ENV is not specified. Now the current env is
   used instead.

- The environment is no longer destroyed when ftests
   complete.

- Do not exit if bootstrap returns an error: assume
   the environment to be already bootstrapped.

- Removed the setup phony target to work around a
   bundletester bug.

For more info, see review comments at
https://bugs.launchpad.net/charms/+bug/1459345

https://code.launchpad.net/~frankban/charms/trusty/redis/tsting-fixes/+merge/262062

(do not edit description out of merge proposal)

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

Affected files (+19, -13 lines):
   M Makefile
   A [revision details]

Index: Makefile
=== modified file 'Makefile'
--- Makefile 2015-06-05 09:15:51 +0000
+++ Makefile 2015-06-16 09:51:39 +0000
@@ -7,7 +7,6 @@
  # Override those values to run functional tests with a different
environment
  # or Juju series.
  SERIES=trusty
-JUJU_ENV=local

  # Define system Debian dependencies: run "make sysdeps" to install them.
  # Please keep them in alphabetical order.
@@ -21,7 +20,7 @@
  PIP = $(VENV)/bin/pip
  FTESTS=$(shell find -L tests -type f -executable | sort)

-.DEFAULT_GOAL := setup
+.DEFAULT_GOAL := $(VENV_ACTIVATE)

  .PHONY: help
  help:
@@ -38,9 +37,10 @@
   @echo 'with the SERIES environment variable and the service name with '
   @echo 'the JUJU_SERVICE_NAME environment variable, for instance:'
   @echo ' make deploy SERIES=precise JUJU_SERVICE_NAME=myredis'
-
-.PHONY: setup
-setup: $(VENV_ACTIVATE)
+ @echo -e '\nWhen using "make deploy" or "make test" or "make ftest" it '
+ @echo 'is possible to override the Juju environement that will be used '
+ @echo 'with the JUJU_ENV environment variable, for instance:'
+ @echo ' make test JUJU_ENV=ec2'

  .PHONY: sysdeps
  sysdeps:
@@ -53,7 +53,7 @@
   @touch $(VENV_ACTIVATE)

  .PHONY: bundletester
-bundletester: setup
+bundletester: $(VENV_ACTIVATE)
   $(PIP) install bundletester
   $(VENV)/bin/bundletester -l DEBUG

@@ -67,13 +67,14 @@
   juju charm proof

  .PHONY: lint
-lint: setup
+lint: $(VENV_ACTIVATE)
   @$(VENV)/bin/flake8 --show-source --exclude=$(VENV) \
    --filename *.py,install,generic-hook \
    hooks/ tests/ unit_tests/

  .PHONY: deploy
  deploy:
+ $(eval JENV := $(shell JUJU_ENV=$(JUJU_ENV) juju switch))
   @# The use of readlink below is required for OS X.
   @$(eval export JUJU_REPOSITORY:=$(shell mktemp -d `readlink -f
/tmp`/temp.XXXX))
   @echo "JUJU_REPOSITORY is $(JUJU_REPOSITORY)"
@@ -82,24 +83,27 @@
   @rsync -a . $(JUJU_REPOSITORY)/${SERIES}/$(JUJU_TEST_CHARM) \
    --exclude .git --exclude .bzr --exclude tests --exclude unit_tests
   @# Deploying the charm.
- juju deploy local:${SERIES}/$(JUJU_TEST_CHARM) $(JUJU_SERVICE_NAME)
+ juju deploy -e $(JENV) local:${SERIES}/$(JUJU_TEST_CHARM)
$(JUJU_SERVICE_NAME)

  .PHONY: test
  test: unittest ftest

  .PHONY: ftest
-ftest: setup
- juju bootstrap -e $(JUJU_ENV) --upload-tools
+ftest: $(VENV_ACTIVATE)
+ $(eval JENV := $(shell JUJU_ENV=$(JUJU_ENV) juju switch))
+ @j...

Read more...

Revision history for this message
Martin Hilton (martin-hilton) wrote :
Revision history for this message
Brad Crittenden (bac) wrote :

LGTM with typo fixes and possible refactoring. No need for re-review.

review: Approve (code)
Revision history for this message
Francesco Banconi (frankban) wrote :

Thank you both for the reviews!

6. By Francesco Banconi

Changes as per review.

Revision history for this message
Francesco Banconi (frankban) wrote :
Revision history for this message
Francesco Banconi (frankban) wrote :

*** Submitted:

Makefile fixes for bundletester.

- The "local" env is no longer used by default when
   JUJU_ENV is not specified. Now the current env is
   used instead.

- The environment is no longer destroyed when ftests
   complete.

- Do not exit if bootstrap returns an error: assume
   the environment to be already bootstrapped.

- Removed the setup phony target to work around a
   bundletester bug.

For more info, see review comments at
https://bugs.launchpad.net/charms/+bug/1459345

R=martin.hilton
CC=
https://codereview.appspot.com/248930043

https://codereview.appspot.com/248930043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-06-05 09:15:51 +0000
3+++ Makefile 2015-06-16 12:50:54 +0000
4@@ -7,7 +7,6 @@
5 # Override those values to run functional tests with a different environment
6 # or Juju series.
7 SERIES=trusty
8-JUJU_ENV=local
9
10 # Define system Debian dependencies: run "make sysdeps" to install them.
11 # Please keep them in alphabetical order.
12@@ -21,7 +20,7 @@
13 PIP = $(VENV)/bin/pip
14 FTESTS=$(shell find -L tests -type f -executable | sort)
15
16-.DEFAULT_GOAL := setup
17+.DEFAULT_GOAL := $(VENV_ACTIVATE)
18
19 .PHONY: help
20 help:
21@@ -38,9 +37,10 @@
22 @echo 'with the SERIES environment variable and the service name with '
23 @echo 'the JUJU_SERVICE_NAME environment variable, for instance:'
24 @echo ' make deploy SERIES=precise JUJU_SERVICE_NAME=myredis'
25-
26-.PHONY: setup
27-setup: $(VENV_ACTIVATE)
28+ @echo -e '\nWhen using "make deploy" or "make test" or "make ftest" it '
29+ @echo 'is possible to override the Juju environment that will be used '
30+ @echo 'with the JUJU_ENV environment variable, for instance:'
31+ @echo ' make test JUJU_ENV=ec2'
32
33 .PHONY: sysdeps
34 sysdeps:
35@@ -53,7 +53,7 @@
36 @touch $(VENV_ACTIVATE)
37
38 .PHONY: bundletester
39-bundletester: setup
40+bundletester: $(VENV_ACTIVATE)
41 $(PIP) install bundletester
42 $(VENV)/bin/bundletester -l DEBUG
43
44@@ -67,13 +67,17 @@
45 juju charm proof
46
47 .PHONY: lint
48-lint: setup
49+lint: $(VENV_ACTIVATE)
50 @$(VENV)/bin/flake8 --show-source --exclude=$(VENV) \
51 --filename *.py,install,generic-hook \
52 hooks/ tests/ unit_tests/
53
54+.PHONY: jenv
55+jenv:
56+ $(eval JENV := $(shell JUJU_ENV=$(JUJU_ENV) juju switch))
57+
58 .PHONY: deploy
59-deploy:
60+deploy: jenv
61 @# The use of readlink below is required for OS X.
62 @$(eval export JUJU_REPOSITORY:=$(shell mktemp -d `readlink -f /tmp`/temp.XXXX))
63 @echo "JUJU_REPOSITORY is $(JUJU_REPOSITORY)"
64@@ -82,24 +86,26 @@
65 @rsync -a . $(JUJU_REPOSITORY)/${SERIES}/$(JUJU_TEST_CHARM) \
66 --exclude .git --exclude .bzr --exclude tests --exclude unit_tests
67 @# Deploying the charm.
68- juju deploy local:${SERIES}/$(JUJU_TEST_CHARM) $(JUJU_SERVICE_NAME)
69+ juju deploy -e $(JENV) local:${SERIES}/$(JUJU_TEST_CHARM) $(JUJU_SERVICE_NAME)
70
71 .PHONY: test
72 test: unittest ftest
73
74 .PHONY: ftest
75-ftest: setup
76- juju bootstrap -e $(JUJU_ENV) --upload-tools
77+ftest: $(VENV_ACTIVATE) jenv
78+ @juju bootstrap -e $(JENV) --upload-tools || \
79+ echo "reusing already bootstrapped $(JENV) environment"
80 @ # Wait for the environment to be ready.
81- juju status -e $(JUJU_ENV)
82+ @juju status -e $(JENV)
83 @# Setting the path is required because internally amulet calls
84 @# juju-deployer using subprocess.
85 PATH="$(VENV)/bin:$(PATH)" $(NOSE) --verbosity 2 -s -x $(FTESTS)
86- juju destroy-environment $(JUJU_ENV) -y
87 @# Clean up deployer garbage.
88 @-$(RM) -rf trusty
89+ @echo "Done! Remember to destroy the environment with:"
90+ @echo "juju destroy-environment $(JENV) -y"
91
92 .PHONY: unittest
93-unittest: setup
94+unittest: $(VENV_ACTIVATE)
95 $(NOSE) --verbosity 2 -s -w unit_tests \
96 --with-coverage --cover-package hooks --cover-erase

Subscribers

People subscribed via source and target branches