Merge lp:~noise/tanuki-agent/test_tarball2 into lp:tanuki-agent
- test_tarball2
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Bret Barker |
Approved revision: | 170 |
Merged at revision: | 170 |
Proposed branch: | lp:~noise/tanuki-agent/test_tarball2 |
Merge into: | lp:tanuki-agent |
Diff against target: |
96 lines (+73/-1) 2 files modified
Makefile (+2/-1) rpi2-sample-provkit/test_tarball_content/test2 (+71/-0) |
To merge this branch: | bzr merge lp:~noise/tanuki-agent/test_tarball2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bret Barker (community) | Approve | ||
Review via email: mp+278625@code.launchpad.net |
Commit message
working GM test with provkit and test_tarball2
Description of the change
The tutorial still needs work, but I just did a successful run with --local-test using a hacked up test_opp.json!
Tanuki Bot (tanuki-bot) wrote : | # |
The attempt to merge lp:~noise/tanuki-agent/test_tarball2 into lp:tanuki-agent failed. Below is the output from the failed tests.
rm -rf env logs
rm -f version_info.py
find . -name '*.pyc' -delete
find . -name '*.~*' -delete
virtualenv -p python3 env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
bzr version-info -r "-1" --format=custom --template="revno = '{revno}'\n" > "version_info.py" || echo "revno = 'UNKNOWN'" > "version_info.py"
rm -rf /tmp/pip-cache
bzr branch lp:~tanuki/tanuki-agent/pip-cache /tmp/pip-cache
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: docopt, requests, requests-oauthlib, oauthlib
Successfully installed docopt requests requests-oauthlib oauthlib
Cleaning up...
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: flake8, pytest, pytest-capturelog, Markdown, pep8, pyflakes, mccabe, py
Successfully installed flake8 pytest pytest-capturelog Markdown pep8 pyflakes mccabe py
Cleaning up...
rm -rf logs
env/bin/py.test agent.py test_agent.py
=======
platform linux -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/tarmac/
plugins: capturelog
collected 49 items
test_agent.py .......
=======
env/bin/flake8 *.py scripts/*.py --max-line-
env/bin/flake8 rpi2-sample-
env/bin/flake8 rpi2-sample-
rpi2-sample-
Tanuki Bot (tanuki-bot) wrote : | # |
The attempt to merge lp:~noise/tanuki-agent/test_tarball2 into lp:tanuki-agent failed. Below is the output from the failed tests.
rm -rf env logs
rm -f version_info.py
find . -name '*.pyc' -delete
find . -name '*.~*' -delete
virtualenv -p python3 env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
bzr version-info -r "-1" --format=custom --template="revno = '{revno}'\n" > "version_info.py" || echo "revno = 'UNKNOWN'" > "version_info.py"
rm -rf /tmp/pip-cache
bzr branch lp:~tanuki/tanuki-agent/pip-cache /tmp/pip-cache
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: docopt, requests, requests-oauthlib, oauthlib
Successfully installed docopt requests requests-oauthlib oauthlib
Cleaning up...
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: flake8, pytest, pytest-capturelog, Markdown, mccabe, pep8, pyflakes, py
Successfully installed flake8 pytest pytest-capturelog Markdown mccabe pep8 pyflakes py
Cleaning up...
rm -rf logs
env/bin/py.test agent.py test_agent.py
=======
platform linux -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/tarmac/
plugins: capturelog
collected 49 items
test_agent.py .......
=======
env/bin/flake8 *.py scripts/*.py --max-line-
env/bin/flake8 rpi2-sample-
env/bin/flake8 rpi2-sample-
rpi2-sample-
Tanuki Bot (tanuki-bot) wrote : | # |
The attempt to merge lp:~noise/tanuki-agent/test_tarball2 into lp:tanuki-agent failed. Below is the output from the failed tests.
rm -rf env logs
rm -f version_info.py
find . -name '*.pyc' -delete
find . -name '*.~*' -delete
virtualenv -p python3 env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
bzr version-info -r "-1" --format=custom --template="revno = '{revno}'\n" > "version_info.py" || echo "revno = 'UNKNOWN'" > "version_info.py"
rm -rf /tmp/pip-cache
bzr branch lp:~tanuki/tanuki-agent/pip-cache /tmp/pip-cache
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: docopt, requests, requests-oauthlib, oauthlib
Successfully installed docopt requests requests-oauthlib oauthlib
Cleaning up...
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: flake8, pytest, pytest-capturelog, Markdown, pyflakes, pep8, mccabe, py
Successfully installed flake8 pytest pytest-capturelog Markdown pyflakes pep8 mccabe py
Cleaning up...
rm -rf logs
env/bin/py.test agent.py test_agent.py
=======
platform linux -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/tarmac/
plugins: capturelog
collected 49 items
test_agent.py .......
=======
env/bin/flake8 *.py scripts/*.py --max-line-
env/bin/flake8 rpi2-sample-
env/bin/flake8 rpi2-sample-
rpi2-sample-
Tanuki Bot (tanuki-bot) wrote : | # |
The attempt to merge lp:~noise/tanuki-agent/test_tarball2 into lp:tanuki-agent failed. Below is the output from the failed tests.
rm -rf env logs
rm -f version_info.py
find . -name '*.pyc' -delete
find . -name '*.~*' -delete
virtualenv -p python3 env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
bzr version-info -r "-1" --format=custom --template="revno = '{revno}'\n" > "version_info.py" || echo "revno = 'UNKNOWN'" > "version_info.py"
rm -rf /tmp/pip-cache
bzr branch lp:~tanuki/tanuki-agent/pip-cache /tmp/pip-cache
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: docopt, requests, requests-oauthlib, oauthlib
Successfully installed docopt requests requests-oauthlib oauthlib
Cleaning up...
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: flake8, pytest, pytest-capturelog, Markdown, pyflakes, pep8, mccabe, py
Successfully installed flake8 pytest pytest-capturelog Markdown pyflakes pep8 mccabe py
Cleaning up...
rm -rf logs
env/bin/py.test agent.py test_agent.py
=======
platform linux -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/tarmac/
plugins: capturelog
collected 49 items
test_agent.py .......
=======
env/bin/flake8 *.py scripts/*.py --max-line-
env/bin/flake8 rpi2-sample-
env/bin/flake8 rpi2-sample-
rpi2-sample-
Tanuki Bot (tanuki-bot) wrote : | # |
The attempt to merge lp:~noise/tanuki-agent/test_tarball2 into lp:tanuki-agent failed. Below is the output from the failed tests.
rm -rf env logs
rm -f version_info.py
find . -name '*.pyc' -delete
find . -name '*.~*' -delete
virtualenv -p python3 env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
bzr version-info -r "-1" --format=custom --template="revno = '{revno}'\n" > "version_info.py" || echo "revno = 'UNKNOWN'" > "version_info.py"
rm -rf /tmp/pip-cache
bzr branch lp:~tanuki/tanuki-agent/pip-cache /tmp/pip-cache
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: docopt, requests, requests-oauthlib, oauthlib
Successfully installed docopt requests requests-oauthlib oauthlib
Cleaning up...
env/bin/pip install --no-index --find-
Ignoring indexes: https:/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Downloading/
Installing collected packages: flake8, pytest, pytest-capturelog, Markdown, pyflakes, mccabe, pep8, py
Successfully installed flake8 pytest pytest-capturelog Markdown pyflakes mccabe pep8 py
Cleaning up...
rm -rf logs
env/bin/py.test agent.py test_agent.py
=======
platform linux -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/tarmac/
plugins: capturelog
collected 49 items
test_agent.py .......
=======
env/bin/flake8 *.py scripts/*.py --max-line-
env/bin/flake8 rpi2-sample-
env/bin/flake8 rpi2-sample-
rpi2-sample-
- 170. By Bret Barker
-
lint
Preview Diff
1 | === modified file 'Makefile' | |||
2 | --- Makefile 2015-11-23 20:17:52 +0000 | |||
3 | +++ Makefile 2015-11-25 20:26:07 +0000 | |||
4 | @@ -20,7 +20,7 @@ | |||
5 | 20 | raw-lint: | 20 | raw-lint: |
6 | 21 | env/bin/flake8 *.py scripts/*.py --max-line-length=99 | 21 | env/bin/flake8 *.py scripts/*.py --max-line-length=99 |
7 | 22 | env/bin/flake8 rpi2-sample-provkit/setup rpi2-sample-provkit/provision rpi2-sample-provkit/provision2 rpi2-sample-provkit/runtest rpi2-sample-provkit/sshrobot rpi2-sample-provkit/utils.py --max-line-length=99 --builtins=raw_input | 22 | env/bin/flake8 rpi2-sample-provkit/setup rpi2-sample-provkit/provision rpi2-sample-provkit/provision2 rpi2-sample-provkit/runtest rpi2-sample-provkit/sshrobot rpi2-sample-provkit/utils.py --max-line-length=99 --builtins=raw_input |
9 | 23 | env/bin/flake8 rpi2-sample-provkit/test_tarball_content/test --max-line-length=99 | 23 | env/bin/flake8 rpi2-sample-provkit/test_tarball_content/test* --max-line-length=99 |
10 | 24 | 24 | ||
11 | 25 | raw-test: | 25 | raw-test: |
12 | 26 | rm -rf logs | 26 | rm -rf logs |
13 | @@ -57,6 +57,7 @@ | |||
14 | 57 | 57 | ||
15 | 58 | test_tarball: | 58 | test_tarball: |
16 | 59 | tar czvf test_tarball.tar.gz -C rpi2-sample-provkit/test_tarball_content test | 59 | tar czvf test_tarball.tar.gz -C rpi2-sample-provkit/test_tarball_content test |
17 | 60 | tar czvf test_tarball2.tar.gz -C rpi2-sample-provkit/test_tarball_content test2 | ||
18 | 60 | 61 | ||
19 | 61 | version: | 62 | version: |
20 | 62 | bzr version-info -r $(REVNO) --format=custom --template="revno = '{revno}'\n" > $(VERSION_FILENAME) || echo "revno = 'UNKNOWN'" > $(VERSION_FILENAME) | 63 | bzr version-info -r $(REVNO) --format=custom --template="revno = '{revno}'\n" > $(VERSION_FILENAME) || echo "revno = 'UNKNOWN'" > $(VERSION_FILENAME) |
21 | 63 | 64 | ||
22 | === added file 'rpi2-sample-provkit/test_tarball_content/test2' | |||
23 | --- rpi2-sample-provkit/test_tarball_content/test2 1970-01-01 00:00:00 +0000 | |||
24 | +++ rpi2-sample-provkit/test_tarball_content/test2 2015-11-25 20:26:07 +0000 | |||
25 | @@ -0,0 +1,71 @@ | |||
26 | 1 | #!/usr/bin/python2 | ||
27 | 2 | |||
28 | 3 | from __future__ import print_function | ||
29 | 4 | |||
30 | 5 | import codecs | ||
31 | 6 | import json | ||
32 | 7 | import os | ||
33 | 8 | import subprocess | ||
34 | 9 | |||
35 | 10 | |||
36 | 11 | def check_test_snap(address, port): | ||
37 | 12 | """Get the version of the test snap.""" | ||
38 | 13 | cmd = ['ssh', '-o' 'StrictHostKeyChecking=no', | ||
39 | 14 | '-o', 'UserKnownHostsFile=/dev/null', '-l', 'ubuntu', | ||
40 | 15 | '-p', port, address, '/apps/bin/test-snap.test-snap -v'] | ||
41 | 16 | output = subprocess.check_output(cmd) | ||
42 | 17 | return output.decode('utf8').strip() | ||
43 | 18 | |||
44 | 19 | |||
45 | 20 | CHECKABLES = [ | ||
46 | 21 | ('test-snap', check_test_snap), | ||
47 | 22 | ] | ||
48 | 23 | RESULT_JSON = "../spi_test_result.json" | ||
49 | 24 | |||
50 | 25 | |||
51 | 26 | def main(): | ||
52 | 27 | """Main entry point.""" | ||
53 | 28 | rpi2_address = os.environ['RPI2_IP'] | ||
54 | 29 | rpi2_ssh_port = os.environ['RPI2_SSH_PORT'] | ||
55 | 30 | test_opp_path = os.environ['TEST_OPPORTUNITY'] | ||
56 | 31 | with codecs.open(test_opp_path, 'rt', encoding='utf8') as fh: | ||
57 | 32 | test_opp = json.load(fh) | ||
58 | 33 | |||
59 | 34 | # find snap(s) to check version | ||
60 | 35 | snaps = {} | ||
61 | 36 | for snap_entry in test_opp['base_snaps']: | ||
62 | 37 | snaps[snap_entry['name']] = snap_entry['sequence'] | ||
63 | 38 | # strip origin to handle test-snap from any myapps user | ||
64 | 39 | if 'test-snap' in snap_entry['name']: | ||
65 | 40 | snaps['test-snap'] = snap_entry['sequence'] | ||
66 | 41 | |||
67 | 42 | for snap_name, snap_revno in test_opp['extra_snaps']: | ||
68 | 43 | snaps[snap_name] = snap_revno | ||
69 | 44 | # strip origin to handle test-snap from any myapps user | ||
70 | 45 | if 'test-snap' in snap_name: | ||
71 | 46 | snaps['test-snap'] = snap_revno | ||
72 | 47 | |||
73 | 48 | # for each snap, get version executing it inside the raspi, and compare | ||
74 | 49 | for snap_name, check_function in CHECKABLES: | ||
75 | 50 | real_revno = check_function(rpi2_address, rpi2_ssh_port) | ||
76 | 51 | print('got installed test-snap sequence: ' + real_revno) | ||
77 | 52 | expected = str(snaps[snap_name]) | ||
78 | 53 | assert real_revno == expected, "real={!r} != expected={!r}".format(real_revno, expected) | ||
79 | 54 | if os.path.exists(RESULT_JSON): | ||
80 | 55 | load = True | ||
81 | 56 | mode = "r+t" | ||
82 | 57 | else: | ||
83 | 58 | load = False | ||
84 | 59 | mode = "wt" | ||
85 | 60 | with codecs.open(RESULT_JSON, mode, encoding="utf8") as fh: | ||
86 | 61 | if load: | ||
87 | 62 | res = json.load(fh) | ||
88 | 63 | else: | ||
89 | 64 | res = {} | ||
90 | 65 | res['result'] = 'OK' | ||
91 | 66 | fh.seek(0) | ||
92 | 67 | json.dump(res, fh) | ||
93 | 68 | |||
94 | 69 | |||
95 | 70 | if __name__ == '__main__': | ||
96 | 71 | main() |
self-approving as it's trivial.