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 | raw-lint: |
6 | env/bin/flake8 *.py scripts/*.py --max-line-length=99 |
7 | 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 |
8 | - env/bin/flake8 rpi2-sample-provkit/test_tarball_content/test --max-line-length=99 |
9 | + env/bin/flake8 rpi2-sample-provkit/test_tarball_content/test* --max-line-length=99 |
10 | |
11 | raw-test: |
12 | rm -rf logs |
13 | @@ -57,6 +57,7 @@ |
14 | |
15 | test_tarball: |
16 | tar czvf test_tarball.tar.gz -C rpi2-sample-provkit/test_tarball_content test |
17 | + tar czvf test_tarball2.tar.gz -C rpi2-sample-provkit/test_tarball_content test2 |
18 | |
19 | version: |
20 | bzr version-info -r $(REVNO) --format=custom --template="revno = '{revno}'\n" > $(VERSION_FILENAME) || echo "revno = 'UNKNOWN'" > $(VERSION_FILENAME) |
21 | |
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 | +#!/usr/bin/python2 |
27 | + |
28 | +from __future__ import print_function |
29 | + |
30 | +import codecs |
31 | +import json |
32 | +import os |
33 | +import subprocess |
34 | + |
35 | + |
36 | +def check_test_snap(address, port): |
37 | + """Get the version of the test snap.""" |
38 | + cmd = ['ssh', '-o' 'StrictHostKeyChecking=no', |
39 | + '-o', 'UserKnownHostsFile=/dev/null', '-l', 'ubuntu', |
40 | + '-p', port, address, '/apps/bin/test-snap.test-snap -v'] |
41 | + output = subprocess.check_output(cmd) |
42 | + return output.decode('utf8').strip() |
43 | + |
44 | + |
45 | +CHECKABLES = [ |
46 | + ('test-snap', check_test_snap), |
47 | +] |
48 | +RESULT_JSON = "../spi_test_result.json" |
49 | + |
50 | + |
51 | +def main(): |
52 | + """Main entry point.""" |
53 | + rpi2_address = os.environ['RPI2_IP'] |
54 | + rpi2_ssh_port = os.environ['RPI2_SSH_PORT'] |
55 | + test_opp_path = os.environ['TEST_OPPORTUNITY'] |
56 | + with codecs.open(test_opp_path, 'rt', encoding='utf8') as fh: |
57 | + test_opp = json.load(fh) |
58 | + |
59 | + # find snap(s) to check version |
60 | + snaps = {} |
61 | + for snap_entry in test_opp['base_snaps']: |
62 | + snaps[snap_entry['name']] = snap_entry['sequence'] |
63 | + # strip origin to handle test-snap from any myapps user |
64 | + if 'test-snap' in snap_entry['name']: |
65 | + snaps['test-snap'] = snap_entry['sequence'] |
66 | + |
67 | + for snap_name, snap_revno in test_opp['extra_snaps']: |
68 | + snaps[snap_name] = snap_revno |
69 | + # strip origin to handle test-snap from any myapps user |
70 | + if 'test-snap' in snap_name: |
71 | + snaps['test-snap'] = snap_revno |
72 | + |
73 | + # for each snap, get version executing it inside the raspi, and compare |
74 | + for snap_name, check_function in CHECKABLES: |
75 | + real_revno = check_function(rpi2_address, rpi2_ssh_port) |
76 | + print('got installed test-snap sequence: ' + real_revno) |
77 | + expected = str(snaps[snap_name]) |
78 | + assert real_revno == expected, "real={!r} != expected={!r}".format(real_revno, expected) |
79 | + if os.path.exists(RESULT_JSON): |
80 | + load = True |
81 | + mode = "r+t" |
82 | + else: |
83 | + load = False |
84 | + mode = "wt" |
85 | + with codecs.open(RESULT_JSON, mode, encoding="utf8") as fh: |
86 | + if load: |
87 | + res = json.load(fh) |
88 | + else: |
89 | + res = {} |
90 | + res['result'] = 'OK' |
91 | + fh.seek(0) |
92 | + json.dump(res, fh) |
93 | + |
94 | + |
95 | +if __name__ == '__main__': |
96 | + main() |
self-approving as it's trivial.