Merge ~peter-sabaini/charm-sudo-pair:fix-functest into ~sudo-pair-charmers/charm-sudo-pair:master

Proposed by Peter Sabaini
Status: Merged
Approved by: Giuseppe Petralia
Approved revision: 185b866eb73095760a2abea3b1ebd4c5b1b6be62
Merged at revision: 185b866eb73095760a2abea3b1ebd4c5b1b6be62
Proposed branch: ~peter-sabaini/charm-sudo-pair:fix-functest
Merge into: ~sudo-pair-charmers/charm-sudo-pair:master
Diff against target: 132 lines (+70/-4)
5 files modified
.gitignore (+1/-1)
Makefile (+50/-0)
tests/functional/requirements.txt (+1/-1)
tests/functional/test_deploy.py (+2/-1)
tox.ini (+16/-1)
Reviewer Review Type Date Requested Status
Joel Sing (community) +1 Approve
Giuseppe Petralia Pending
Sudo_pair Charmers Pending
Review via email: mp+361550@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Joel Sing (jsing) wrote :

LGTM from a readability/standards perspective, with some minor comments.

Please get a review from a domain expert/peer for the functionality change.

review: Approve (+1)
Revision history for this message
Peter Sabaini (peter-sabaini) wrote :

Thanks for the review, added changes

@Guiseppe, can I ask for a review from you as well please?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 70c6568..a437a87 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -4,4 +4,4 @@ __pycache__
6 builds/
7 .idea
8 .tox
9-
10+/repo-info
11diff --git a/Makefile b/Makefile
12new file mode 100644
13index 0000000..460970a
14--- /dev/null
15+++ b/Makefile
16@@ -0,0 +1,50 @@
17+PROJECTPATH = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
18+ifndef JUJU_REPOSITORY
19+ JUJU_REPOSITORY := $(shell pwd)
20+ $(warning Warning JUJU_REPOSITORY was not set, defaulting to $(JUJU_REPOSITORY))
21+endif
22+
23+help:
24+ @echo "This project supports the following targets"
25+ @echo ""
26+ @echo " make help - show this text"
27+ @echo " make lint - run flake8"
28+ @echo " make test - run the unittests and lint"
29+ @echo " make unittest - run the tests defined in the unit subdirectory"
30+ @echo " make functional - run the tests defined in the functional subdirectory"
31+ @echo " make release - build the charm"
32+ @echo " make clean - remove unneeded files"
33+ @echo ""
34+
35+submodules:
36+ @echo "Cloning submodules"
37+ @git submodule update --init --recursive
38+
39+lint:
40+ @echo "Running flake8"
41+ @tox -e lint
42+
43+test: unittest functional lint
44+
45+unittest:
46+ @tox -e unit
47+
48+functional: build
49+ @tox -e functional
50+
51+build:
52+ @echo "Building charm to base directory $(JUJU_REPOSITORY)"
53+ @-git describe --tags > $(PROJECTPATH)/repo-info
54+ @LAYER_PATH=./layers INTERFACE_PATH=./interfaces\
55+ JUJU_REPOSITORY=$(JUJU_REPOSITORY) charm build ./ --force
56+
57+release: clean build
58+ @echo "Charm is built at $(JUJU_REPOSITORY)/builds"
59+
60+clean:
61+ @echo "Cleaning files"
62+ @rm -rf $(PROJECTPATH)/.tox
63+ @rm -rf $(PROJECTPATH)/.pytest_cache
64+
65+# The targets below don't depend on a file
66+.PHONY: lint test unittest functional build release clean help submodules
67diff --git a/tests/functional/requirements.txt b/tests/functional/requirements.txt
68index b9815c2..6c6cdc6 100644
69--- a/tests/functional/requirements.txt
70+++ b/tests/functional/requirements.txt
71@@ -1,6 +1,6 @@
72 juju
73 requests
74-pytest
75+pytest==4.0.2
76 pytest-asyncio
77 mock
78 flake8
79diff --git a/tests/functional/test_deploy.py b/tests/functional/test_deploy.py
80index 6ce4ec3..9b27ba2 100644
81--- a/tests/functional/test_deploy.py
82+++ b/tests/functional/test_deploy.py
83@@ -1,5 +1,6 @@
84 #!/usr/bin/python3.6
85
86+import os
87 import pytest
88
89 pytestmark = pytest.mark.asyncio
90@@ -25,7 +26,7 @@ async def deploy_app(request, model):
91 channel='stable'
92 )
93 sudo_pair_app = await model.deploy(
94- 'local:',
95+ '{}/builds/sudo-pair'.format(os.getenv('JUJU_REPOSITORY')),
96 application_name='sudo-pair-' + release,
97 series=release,
98 num_units=0,
99diff --git a/tox.ini b/tox.ini
100index 3750c4a..123e618 100644
101--- a/tox.ini
102+++ b/tox.ini
103@@ -5,6 +5,8 @@ skip_missing_interpreters = True
104
105 [testenv]
106 basepython = python3.6
107+setenv =
108+ PYTHONPATH = .
109
110 [testenv:unit]
111 commands = pytest -v --ignore {toxinidir}/tests/amulet --ignore {toxinidir}/tests/functional
112@@ -12,6 +14,19 @@ deps = -r{toxinidir}/tests/unit/requirements.txt
113 setenv = PYTHONPATH={toxinidir}/lib
114
115 [testenv:functional]
116-passenv = HOME
117+passenv =
118+ HOME
119+ JUJU_REPOSITORY
120+ PATH
121 commands = pytest -v --ignore {toxinidir}/tests/unit --ignore {toxinidir}/tests/amulet
122 deps = -r{toxinidir}/tests/functional/requirements.txt
123+
124+[testenv:lint]
125+commands = flake8
126+deps = flake8
127+
128+[flake8]
129+exclude =
130+ .git,
131+ __pycache__,
132+ .tox,

Subscribers

People subscribed via source and target branches