Merge lp:~cprov/tanuki-agent/tutorial-results into lp:tanuki-agent

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 118
Merged at revision: 117
Proposed branch: lp:~cprov/tanuki-agent/tutorial-results
Merge into: lp:tanuki-agent
Diff against target: 101 lines (+26/-21)
1 file modified
docs/tutorial.md (+26/-21)
To merge this branch: bzr merge lp:~cprov/tanuki-agent/tutorial-results
Reviewer Review Type Date Requested Status
Evan (community) Approve
Celso Providelo (community) Approve
Facundo Batista (community) Approve
Review via email: mp+275218@code.launchpad.net

Commit message

Using api-example.py binary and adding test-result reference queries.

Description of the change

Using api-example.py binary and adding test-result reference queries.

To post a comment you must log in.
Revision history for this message
Evan (ev) wrote :

Minor nits.

review: Needs Fixing
Revision history for this message
Facundo Batista (facundo) wrote :

Awesome

review: Approve
118. By Celso Providelo

addressing review comments.

Revision history for this message
Celso Providelo (cprov) wrote :

Thank, Evan and Facundo.

Review comments addressed, might be worth another glance on language and flow.

Revision history for this message
Celso Providelo (cprov) wrote :

Well, we can iterate further ... let's land it and quit conflicting with other branches around.

review: Approve
Revision history for this message
Evan (ev) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/tutorial.md'
2--- docs/tutorial.md 2015-10-21 10:10:49 +0000
3+++ docs/tutorial.md 2015-10-21 18:35:24 +0000
4@@ -125,10 +125,6 @@
5
6 See https://developer.ubuntu.com/en/snappy/start/ for further details.
7
8-Also, install Paramiko dependency:
9-
10- $ sudo apt-get install python-paramiko
11-
12 Next, you will create an image for RPI2 from the rolling/edge channel, with our test-snap pre-installed:
13
14 $ wget http://people.canonical.com/~cprov/snappy/raspberrypi2/test-snap\_1\_all.snap
15@@ -179,7 +175,7 @@
16
17 So, in the agent directory execute the following from your computer (where you already authenticated during the lab setup above):
18
19- ./scripts/api_example.py -X POST config.ini \
20+ ./api_example.py -X POST config.ini \
21 https://spi.canonical.com/orgs/$ORGANIZATION/products/manifests
22 --data '{
23 "image\_name": "tutorial-raspi2-image",
24@@ -205,7 +201,7 @@
25
26 So, execute the following:
27
28- ./scripts/api_example.py -X POST config.ini \
29+ ./api_example.py -X POST config.ini \
30 https://spi.canonical.com/orgs/$ORGANIZATION/tests/specs --data '{
31 "platform": "spi-tutorial-raspi2",
32 "image_name": "tutorial-raspi2-image",
33@@ -228,13 +224,13 @@
34
35 Now we’ll tell SPI manually that a new version of the snap we’re using for the tutorial is available:
36
37- ./scripts/api_example.py -X POST config.ini \
38+ ./api_example.py -X POST config.ini \
39 https://spi.canonical.com/orgs/$ORGANIZATION/snap-revisions --data '{
40 "name": "test-snap.spi-test",
41 "revision": 2
42 }'
43
44-In the response there is a image_unique_id that will be used next, please keep it around.
45+In the response there is a ```test_opportunity_id``` and ```image_unique_id``` that will be used next, please keep it around.
46
47 At this point the SPI has generated a message that is waiting to be consumed by our Agent, and when that message arrives the Agent will try to run the commands to provision, setup and run the tests. For that we need to put useful commands in the config file. So, edit ```config.ini``` and replace the following three fields (the path needs to be absolute, be sure to replace the correct values):
48
49@@ -242,6 +238,10 @@
50 setupcommand = PATH_TO_AGENT/rpi2-sample-provkit/setup
51 testcommand = PATH_TO_AGENT/rpi2-sample-provkit/runtest
52
53+You will need to install some supporting libraries to use the Raspberry Pi 2 sample Provisioning Kit:
54+
55+ $ sudo apt-get install python-paramiko python-requests
56+
57 Next step, then, is to start the Agent to get that message and start running the test. As of this moment, we’d need to set up the Raspberry Pi manually, so the Agent after receiving the test to run will produce some instructions to get an image and burn it into the device, so please follow those instructions and let the Agent know when you’re ready (it will wait for you to press Enter).
58
59 So, run:
60@@ -257,24 +257,29 @@
61 system, where they stands (to be run, or already run, etc), checking the
62 events in the system:
63
64- ./scripts/api_example.py config.ini \
65- https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_name=tutorial-raspi2-image
66-
67-Also, you can see the results produced for all the organization, doing
68-
69- ./scripts/api_example.py config.ini \
70- https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_name=tutorial-raspi2-image
71+ ./api_example.py config.ini \
72+ https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?test_opportunity_id=<test_opportunity_id>
73
74 Or even check the results for an specific image (you can get the image
75 id from the response of the query when you told the system above that a
76 new snap revision was available):
77
78- ./scripts/api_example.py config.ini \
79- https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_name=tutorial-raspi2-image/<unique_image_id>
80-
81-<!--
82-ToDo: add example to query the actual result
83--->
84+ ./api_example.py config.ini \
85+ https://spi.canonical.com/orgs/$ORGANIZATION/tests/events?image_unique_id=<unique_image_id>
86+
87+You can see the results produced for all products within an organisation by running:
88+
89+ ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/tests/events
90+
91+All tests containing 'RESULT_POSTED' events will have results to be retrieved from SPI:
92+
93+ ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/results
94+
95+Or you may directly poll for specific results using filters, as below:
96+
97+ ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/results?image_unique_id=<image_unique_id>
98+ ./api_example.py config.ini https://spi.canonical.com/orgs/$ORGANIZATION/results?image_name=tutorial-raspi2-image
99+
100
101 ## Other Testing Scenarios
102

Subscribers

People subscribed via source and target branches

to all changes: