Merge lp:~hduran-8/juju-ci-tools/repository_add_storagetest into lp:juju-ci-tools/repository

Proposed by Horacio Durán
Status: Work in progress
Proposed branch: lp:~hduran-8/juju-ci-tools/repository_add_storagetest
Merge into: lp:juju-ci-tools/repository
Diff against target: 528 lines (+471/-0)
10 files modified
trusty/storagetest/README.md (+52/-0)
trusty/storagetest/copyright (+17/-0)
trusty/storagetest/hooks/filesystem-storage-attached (+26/-0)
trusty/storagetest/hooks/install (+2/-0)
trusty/storagetest/hooks/proof.txt (+1/-0)
trusty/storagetest/icon.svg (+279/-0)
trusty/storagetest/metadata.yaml (+15/-0)
trusty/storagetest/revision (+1/-0)
trusty/storagetest/tests/00-setup.sh (+7/-0)
trusty/storagetest/tests/10-deploy-test.py (+71/-0)
To merge this branch: bzr merge lp:~hduran-8/juju-ci-tools/repository_add_storagetest
Reviewer Review Type Date Requested Status
Juju Release Engineering Pending
Review via email: mp+262867@code.launchpad.net

Description of the change

Add a charm to test storage.

A new charm "storagetest" has been added, it helps test storage by creating a file on a given hook that can then be checked by tests.

To post a comment you must log in.

Unmerged revisions

21. By Horacio Durán

Added storagetest charm

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'trusty/storagetest'
2=== added file 'trusty/storagetest/README.md'
3--- trusty/storagetest/README.md 1970-01-01 00:00:00 +0000
4+++ trusty/storagetest/README.md 2015-06-24 15:34:07 +0000
5@@ -0,0 +1,52 @@
6+# Overview
7+
8+This charm provides a blank [Ubuntu](http://ubuntu.com) image. It does not provide any services other than a blank cloud image for you to manage manually, it is intended for testing and development.
9+
10+# Usage
11+
12+Step by step instructions on using this charm:
13+
14+ juju deploy ubuntu
15+
16+You can then ssh to the instance with:
17+
18+ juju ssh ubuntu/0
19+
20+## Scale out Usage
21+
22+This charm is not designed to be used at scale since it does not have any relationships, however you can bulk add machines with `add-unit`:
23+
24+ juju add-unit ubuntu # Add one more
25+ juju add-unit -n5 ubuntu # Add 5 at a time
26+
27+
28+You can also alias names in order to organize a bunch of empty instances:
29+
30+ juju deploy ubuntu mytestmachine1
31+ juju deploy ubuntu mytestmachine2
32+
33+and so on.
34+
35+## Known Limitations and Issues
36+
37+This charm does not provide anything other than a blank server, so it does not relate to other charms.
38+
39+# Configuration
40+
41+This charm has no configuration options.
42+
43+# Contact Information
44+
45+
46+## Upstream Project Name
47+
48+- [Ubuntu](http://ubuntu.com)
49+- [Bug tracker](http://bugs.launchpad.net/ubuntu)
50+- [Ubuntu Server Mailing list](https://lists.ubuntu.com/archives/ubuntu-server/)
51+
52+## Charm Contact Information
53+
54+- Author: Juju Charm Community
55+- Report bugs at: [http://bugs.launchpad.net/charms/+source/ubuntu](http://bugs.launchpad.net/charms/+source/ubuntu)
56+- Location: [http://jujucharms.com/charms/precise/ubuntu](http://jujucharms.com/charms/precise/ubuntu)
57+
58
59=== added file 'trusty/storagetest/copyright'
60--- trusty/storagetest/copyright 1970-01-01 00:00:00 +0000
61+++ trusty/storagetest/copyright 2015-06-24 15:34:07 +0000
62@@ -0,0 +1,17 @@
63+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
64+
65+Files: *
66+Copyright: Copyright 2012, Canonical Ltd., All Rights Reserved.
67+License: GPL-3
68+ This program is free software: you can redistribute it and/or modify
69+ it under the terms of the GNU General Public License as published by
70+ the Free Software Foundation, either version 3 of the License, or
71+ (at your option) any later version.
72+ .
73+ This program is distributed in the hope that it will be useful,
74+ but WITHOUT ANY WARRANTY; without even the implied warranty of
75+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76+ GNU General Public License for more details.
77+ .
78+ You should have received a copy of the GNU General Public License
79+ along with this program. If not, see <http://www.gnu.org/licenses/>.
80
81=== added directory 'trusty/storagetest/hooks'
82=== added file 'trusty/storagetest/hooks/filesystem-storage-attached'
83--- trusty/storagetest/hooks/filesystem-storage-attached 1970-01-01 00:00:00 +0000
84+++ trusty/storagetest/hooks/filesystem-storage-attached 2015-06-24 15:34:07 +0000
85@@ -0,0 +1,26 @@
86+#!/usr/bin/python
87+from subprocess import call, check_output
88+from os.path import join as pjoin
89+
90+PROOF = "This text is the proof that storage-attached hook ran with"\
91+ " %s storage"
92+
93+call(["juju-log", "Storage attached"])
94+storage_info = check_output("storage-get")
95+call(["juju-log", "Storage info: %s" % storage_info])
96+lines = storage_info.strip().splitlines()
97+out = dict((k.strip(),v.strip()) for k,v in
98+ [line.split(":") for line in lines])
99+call(["juju-log", "Storage info parsed: %s" % out])
100+assert "kind" in out, "storage-get did not return kind"
101+assert "location" in out, "storage-get did not return location"
102+
103+proof = PROOF % out["kind"]
104+plocation = pjoin(out["location"], "proof.txt")
105+with open(plocation, "w") as pfile:
106+ try:
107+ pfile.write(proof)
108+ except Exception, e:
109+ call(["juju-log", "Storage proof failed: %s" % e])
110+
111+call(["juju-log", "Storage proof written to %s" % plocation])
112
113=== added file 'trusty/storagetest/hooks/install'
114--- trusty/storagetest/hooks/install 1970-01-01 00:00:00 +0000
115+++ trusty/storagetest/hooks/install 2015-06-24 15:34:07 +0000
116@@ -0,0 +1,2 @@
117+#!/bin/bash
118+# Does nothing. - charm proof requires an install hook.
119
120=== added file 'trusty/storagetest/hooks/proof.txt'
121--- trusty/storagetest/hooks/proof.txt 1970-01-01 00:00:00 +0000
122+++ trusty/storagetest/hooks/proof.txt 2015-06-24 15:34:07 +0000
123@@ -0,0 +1,1 @@
124+This text is the proof that storage-attached hook ran with filesystem storage
125\ No newline at end of file
126
127=== added symlink 'trusty/storagetest/hooks/testnativefs-storage-attached'
128=== target is u'filesystem-storage-attached'
129=== added symlink 'trusty/storagetest/hooks/testrootfs-storage-attached'
130=== target is u'filesystem-storage-attached'
131=== added file 'trusty/storagetest/icon.svg'
132--- trusty/storagetest/icon.svg 1970-01-01 00:00:00 +0000
133+++ trusty/storagetest/icon.svg 2015-06-24 15:34:07 +0000
134@@ -0,0 +1,279 @@
135+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
136+<!-- Created with Inkscape (http://www.inkscape.org/) -->
137+
138+<svg
139+ xmlns:dc="http://purl.org/dc/elements/1.1/"
140+ xmlns:cc="http://creativecommons.org/ns#"
141+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
142+ xmlns:svg="http://www.w3.org/2000/svg"
143+ xmlns="http://www.w3.org/2000/svg"
144+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
145+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
146+ width="96"
147+ height="96"
148+ id="svg6517"
149+ version="1.1"
150+ inkscape:version="0.48.4 r9939"
151+ sodipodi:docname="icon.svg">
152+ <defs
153+ id="defs6519">
154+ <linearGradient
155+ id="Background">
156+ <stop
157+ id="stop4178"
158+ offset="0"
159+ style="stop-color:#b8b8b8;stop-opacity:1" />
160+ <stop
161+ id="stop4180"
162+ offset="1"
163+ style="stop-color:#c9c9c9;stop-opacity:1" />
164+ </linearGradient>
165+ <filter
166+ style="color-interpolation-filters:sRGB;"
167+ inkscape:label="Inner Shadow"
168+ id="filter1121">
169+ <feFlood
170+ flood-opacity="0.59999999999999998"
171+ flood-color="rgb(0,0,0)"
172+ result="flood"
173+ id="feFlood1123" />
174+ <feComposite
175+ in="flood"
176+ in2="SourceGraphic"
177+ operator="out"
178+ result="composite1"
179+ id="feComposite1125" />
180+ <feGaussianBlur
181+ in="composite1"
182+ stdDeviation="1"
183+ result="blur"
184+ id="feGaussianBlur1127" />
185+ <feOffset
186+ dx="0"
187+ dy="2"
188+ result="offset"
189+ id="feOffset1129" />
190+ <feComposite
191+ in="offset"
192+ in2="SourceGraphic"
193+ operator="atop"
194+ result="composite2"
195+ id="feComposite1131" />
196+ </filter>
197+ <filter
198+ style="color-interpolation-filters:sRGB;"
199+ inkscape:label="Drop Shadow"
200+ id="filter950">
201+ <feFlood
202+ flood-opacity="0.25"
203+ flood-color="rgb(0,0,0)"
204+ result="flood"
205+ id="feFlood952" />
206+ <feComposite
207+ in="flood"
208+ in2="SourceGraphic"
209+ operator="in"
210+ result="composite1"
211+ id="feComposite954" />
212+ <feGaussianBlur
213+ in="composite1"
214+ stdDeviation="1"
215+ result="blur"
216+ id="feGaussianBlur956" />
217+ <feOffset
218+ dx="0"
219+ dy="1"
220+ result="offset"
221+ id="feOffset958" />
222+ <feComposite
223+ in="SourceGraphic"
224+ in2="offset"
225+ operator="over"
226+ result="composite2"
227+ id="feComposite960" />
228+ </filter>
229+ <clipPath
230+ clipPathUnits="userSpaceOnUse"
231+ id="clipPath873">
232+ <g
233+ transform="matrix(0,-0.66666667,0.66604479,0,-258.25992,677.00001)"
234+ id="g875"
235+ inkscape:label="Layer 1"
236+ style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline">
237+ <path
238+ style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline"
239+ d="m 46.702703,898.22775 50.594594,0 C 138.16216,898.22775 144,904.06497 144,944.92583 l 0,50.73846 c 0,40.86071 -5.83784,46.69791 -46.702703,46.69791 l -50.594594,0 C 5.8378378,1042.3622 0,1036.525 0,995.66429 L 0,944.92583 C 0,904.06497 5.8378378,898.22775 46.702703,898.22775 Z"
240+ id="path877"
241+ inkscape:connector-curvature="0"
242+ sodipodi:nodetypes="sssssssss" />
243+ </g>
244+ </clipPath>
245+ <filter
246+ inkscape:collect="always"
247+ id="filter891"
248+ inkscape:label="Badge Shadow">
249+ <feGaussianBlur
250+ inkscape:collect="always"
251+ stdDeviation="0.71999962"
252+ id="feGaussianBlur893" />
253+ </filter>
254+ </defs>
255+ <sodipodi:namedview
256+ id="base"
257+ pagecolor="#ffffff"
258+ bordercolor="#666666"
259+ borderopacity="1.0"
260+ inkscape:pageopacity="0.0"
261+ inkscape:pageshadow="2"
262+ inkscape:zoom="4.0745362"
263+ inkscape:cx="-28.607257"
264+ inkscape:cy="88.286442"
265+ inkscape:document-units="px"
266+ inkscape:current-layer="layer3"
267+ showgrid="true"
268+ fit-margin-top="0"
269+ fit-margin-left="0"
270+ fit-margin-right="0"
271+ fit-margin-bottom="0"
272+ inkscape:window-width="1680"
273+ inkscape:window-height="1026"
274+ inkscape:window-x="1920"
275+ inkscape:window-y="24"
276+ inkscape:window-maximized="1"
277+ showborder="true"
278+ showguides="true"
279+ inkscape:guide-bbox="true"
280+ inkscape:showpageshadow="false">
281+ <inkscape:grid
282+ type="xygrid"
283+ id="grid821" />
284+ <sodipodi:guide
285+ orientation="1,0"
286+ position="16,48"
287+ id="guide823" />
288+ <sodipodi:guide
289+ orientation="0,1"
290+ position="64,80"
291+ id="guide825" />
292+ <sodipodi:guide
293+ orientation="1,0"
294+ position="80,40"
295+ id="guide827" />
296+ <sodipodi:guide
297+ orientation="0,1"
298+ position="64,16"
299+ id="guide829" />
300+ </sodipodi:namedview>
301+ <metadata
302+ id="metadata6522">
303+ <rdf:RDF>
304+ <cc:Work
305+ rdf:about="">
306+ <dc:format>image/svg+xml</dc:format>
307+ <dc:type
308+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
309+ <dc:title></dc:title>
310+ </cc:Work>
311+ </rdf:RDF>
312+ </metadata>
313+ <g
314+ inkscape:label="BACKGROUND"
315+ inkscape:groupmode="layer"
316+ id="layer1"
317+ transform="translate(268,-635.29076)"
318+ style="display:inline">
319+ <path
320+ style="fill:#ffffff;fill-opacity:1;stroke:none;display:inline;filter:url(#filter1121)"
321+ d="m -268,700.15563 0,-33.72973 c 0,-27.24324 3.88785,-31.13513 31.10302,-31.13513 l 33.79408,0 c 27.21507,0 31.1029,3.89189 31.1029,31.13513 l 0,33.72973 c 0,27.24325 -3.88783,31.13514 -31.1029,31.13514 l -33.79408,0 C -264.11215,731.29077 -268,727.39888 -268,700.15563 Z"
322+ id="path6455"
323+ inkscape:connector-curvature="0"
324+ sodipodi:nodetypes="sssssssss" />
325+ </g>
326+ <g
327+ inkscape:groupmode="layer"
328+ id="layer3"
329+ inkscape:label="PLACE YOUR PICTOGRAM HERE"
330+ style="display:inline">
331+ <path
332+ style="fill:#dd4814"
333+ inkscape:connector-curvature="0"
334+ d="m 80.02465,48.074075 c 0,17.686843 -14.339141,32.025811 -32.0271,32.025811 -17.687958,0 -32.026421,-14.338743 -32.026421,-32.025811 0,-17.688199 14.338241,-32.026715 32.026195,-32.026715 17.68796,0 32.027326,14.338516 32.027326,32.026715 z"
335+ id="path4010" />
336+ <path
337+ style="fill:#ffffff"
338+ inkscape:connector-curvature="0"
339+ d="m 26.220054,43.798393 c -2.362021,0 -4.275962,1.913911 -4.275962,4.275907 0,2.361093 1.913941,4.275231 4.275962,4.275231 2.361119,0 4.275282,-1.914138 4.275282,-4.275231 0,-2.362222 -1.913941,-4.275907 -4.275282,-4.275907 z m 30.529623,19.433315 c -2.045225,1.18066 -2.745267,3.794605 -1.565046,5.838898 1.1809,2.045195 3.794652,2.745681 5.839872,1.565023 2.044543,-1.180434 2.74504,-3.79438 1.564365,-5.839349 -1.180448,-2.044293 -3.794653,-2.745006 -5.839191,-1.564572 z M 35.507719,48.073623 c 0,-4.225745 2.099906,-7.958209 5.311109,-10.218297 l -3.126015,-5.236253 c -3.742,2.500061 -6.52546,6.322008 -7.681724,10.798345 1.350601,1.100895 2.213568,2.777317 2.213568,4.656657 0,1.878886 -0.862967,3.55531 -2.21379,4.655978 1.156042,4.47679 3.93971,8.298736 7.681724,10.798571 L 40.818828,58.29192 C 37.607625,56.032284 35.507719,52.300044 35.507719,48.073623 z M 47.998001,35.583488 c 6.525227,0 11.877689,5.003059 12.438766,11.382461 l 6.093858,-0.08903 c -0.29986,-4.709984 -2.357282,-8.939569 -5.519227,-12.048149 -1.625601,0.614168 -3.503606,0.521072 -5.126722,-0.416225 -1.625149,-0.938201 -2.644935,-2.52085 -2.924231,-4.238398 -1.579953,-0.437239 -3.242841,-0.67563 -4.962218,-0.67563 -2.956999,0 -5.750608,0.694159 -8.232178,1.9234 l 2.970551,5.323701 c 1.599166,-0.744098 3.381133,-1.162131 5.261401,-1.162131 z m 0,24.980495 c -1.88049,0 -3.662235,-0.418033 -5.261623,-1.162131 l -2.971009,5.324152 c 2.481792,1.22879 5.275637,1.923176 8.232632,1.923176 1.719377,0 3.382263,-0.238391 4.962444,-0.67563 0.279296,-1.71755 1.299306,-3.300198 2.924683,-4.239076 1.623114,-0.936846 3.501122,-1.029942 5.126723,-0.415548 3.16172,-3.108806 5.219142,-7.338391 5.518545,-12.048375 l -6.093857,-0.08903 c -0.560621,6.380306 -5.913311,11.382461 -12.438538,11.382461 z m 8.750994,-27.648671 c 2.044997,1.18111 4.6592,0.480398 5.83942,-1.563894 1.1809,-2.045197 0.480858,-4.659142 -1.564362,-5.840027 -2.04477,-1.180434 -4.658747,-0.479947 -5.839647,1.565249 -1.180448,2.044291 -0.479954,4.658463 1.564589,5.838672 z"
340+ id="path4012" />
341+ </g>
342+ <g
343+ inkscape:groupmode="layer"
344+ id="layer2"
345+ inkscape:label="BADGE"
346+ style="display:none"
347+ sodipodi:insensitive="true">
348+ <g
349+ style="display:inline"
350+ transform="translate(-340.00001,-581)"
351+ id="g4394"
352+ clip-path="none">
353+ <g
354+ id="g855">
355+ <g
356+ inkscape:groupmode="maskhelper"
357+ id="g870"
358+ clip-path="url(#clipPath873)"
359+ style="opacity:0.6;filter:url(#filter891)">
360+ <path
361+ transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-237.54282)"
362+ d="m 264,552.36218 c 0,6.62742 -5.37258,12 -12,12 -6.62742,0 -12,-5.37258 -12,-12 0,-6.62741 5.37258,-12 12,-12 6.62742,0 12,5.37259 12,12 z"
363+ sodipodi:ry="12"
364+ sodipodi:rx="12"
365+ sodipodi:cy="552.36218"
366+ sodipodi:cx="252"
367+ id="path844"
368+ style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
369+ sodipodi:type="arc" />
370+ </g>
371+ <g
372+ id="g862">
373+ <path
374+ sodipodi:type="arc"
375+ style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
376+ id="path4398"
377+ sodipodi:cx="252"
378+ sodipodi:cy="552.36218"
379+ sodipodi:rx="12"
380+ sodipodi:ry="12"
381+ d="m 264,552.36218 c 0,6.62742 -5.37258,12 -12,12 -6.62742,0 -12,-5.37258 -12,-12 0,-6.62741 5.37258,-12 12,-12 6.62742,0 12,5.37259 12,12 z"
382+ transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-238.54282)" />
383+ <path
384+ transform="matrix(1.25,0,0,1.25,33,-100.45273)"
385+ d="m 264,552.36218 c 0,6.62742 -5.37258,12 -12,12 -6.62742,0 -12,-5.37258 -12,-12 0,-6.62741 5.37258,-12 12,-12 6.62742,0 12,5.37259 12,12 z"
386+ sodipodi:ry="12"
387+ sodipodi:rx="12"
388+ sodipodi:cy="552.36218"
389+ sodipodi:cx="252"
390+ id="path4400"
391+ style="color:#000000;fill:#dd4814;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
392+ sodipodi:type="arc" />
393+ <path
394+ sodipodi:type="star"
395+ style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
396+ id="path4459"
397+ sodipodi:sides="5"
398+ sodipodi:cx="666.19574"
399+ sodipodi:cy="589.50385"
400+ sodipodi:r1="7.2431178"
401+ sodipodi:r2="4.3458705"
402+ sodipodi:arg1="1.0471976"
403+ sodipodi:arg2="1.6755161"
404+ inkscape:flatsided="false"
405+ inkscape:rounded="0.1"
406+ inkscape:randomized="0"
407+ d="m 669.8173,595.77657 c -0.39132,0.22593 -3.62645,-1.90343 -4.07583,-1.95066 -0.44938,-0.0472 -4.05653,1.36297 -4.39232,1.06062 -0.3358,-0.30235 0.68963,-4.03715 0.59569,-4.47913 -0.0939,-0.44198 -2.5498,-3.43681 -2.36602,-3.8496 0.18379,-0.41279 4.05267,-0.59166 4.44398,-0.81759 0.39132,-0.22593 2.48067,-3.48704 2.93005,-3.4398 0.44938,0.0472 1.81505,3.67147 2.15084,3.97382 0.3358,0.30236 4.08294,1.2817 4.17689,1.72369 0.0939,0.44198 -2.9309,2.86076 -3.11469,3.27355 -0.18379,0.41279 0.0427,4.27917 -0.34859,4.5051 z"
408+ transform="matrix(1.511423,-0.16366377,0.16366377,1.511423,-755.37346,-191.93651)" />
409+ </g>
410+ </g>
411+ </g>
412+ </g>
413+</svg>
414
415=== added file 'trusty/storagetest/metadata.yaml'
416--- trusty/storagetest/metadata.yaml 1970-01-01 00:00:00 +0000
417+++ trusty/storagetest/metadata.yaml 2015-06-24 15:34:07 +0000
418@@ -0,0 +1,15 @@
419+name: storagetest
420+summary: charm to test storage
421+maintainer: Andrew Wilkins <Andrew.Wilkins@ultra>
422+description: |
423+ a charm to test storage in CI
424+categories:
425+ - misc
426+subordinate: false
427+storage:
428+ testrootfs:
429+ type: filesystem
430+ location: /mnt/testrootfs
431+ testnativefs:
432+ type: filesystem
433+ location: /mnt/testnativefs
434
435=== added file 'trusty/storagetest/revision'
436--- trusty/storagetest/revision 1970-01-01 00:00:00 +0000
437+++ trusty/storagetest/revision 2015-06-24 15:34:07 +0000
438@@ -0,0 +1,1 @@
439+1
440
441=== added directory 'trusty/storagetest/tests'
442=== added file 'trusty/storagetest/tests/00-setup.sh'
443--- trusty/storagetest/tests/00-setup.sh 1970-01-01 00:00:00 +0000
444+++ trusty/storagetest/tests/00-setup.sh 2015-06-24 15:34:07 +0000
445@@ -0,0 +1,7 @@
446+#!/bin/sh
447+
448+# Install Amulet testing harness as it is not on the
449+# default cloud image. Amulet should pull in its dependencies.
450+sudo add-apt-repository -y ppa:juju/stable
451+sudo apt-get update
452+sudo apt-get install -y amulet
453
454=== added file 'trusty/storagetest/tests/10-deploy-test.py'
455--- trusty/storagetest/tests/10-deploy-test.py 1970-01-01 00:00:00 +0000
456+++ trusty/storagetest/tests/10-deploy-test.py 2015-06-24 15:34:07 +0000
457@@ -0,0 +1,71 @@
458+#!/usr/bin/python3
459+
460+# This Amulet based tests
461+# The goal is to ensure the Ubuntu charm
462+# sucessfully deploys and can be accessed.
463+# Note the Ubuntu charm does not have any
464+# relations or config options.
465+
466+import amulet
467+#import os
468+#import requests
469+
470+# Timeout value, in seconds to deploy the environment
471+seconds = 900
472+
473+# Set up the deployer module to interact and set up the environment.
474+d = amulet.Deployment()
475+
476+# Define the environment in terms of charms, their config, and relations.
477+
478+# Add the Ubuntu charm to the deployment.
479+d.add('ubuntu')
480+
481+# Deploy the environment currently defined
482+try:
483+ # Wait the defined about amount of time to deploy the environment.
484+ # Setup makes sure the services are deployed, related, and in a
485+ # "started" state.
486+ d.setup(timeout=seconds)
487+ # Use a sentry to ensure there are no remaining hooks being execute
488+ # on any of the nodes
489+## d.sentry.wait()
490+except amulet.helpers.TimeoutError:
491+ # Pending the configuration the test will fail or be skipped
492+ # if not deployed properly.
493+ error_message = 'The environment did not deploy in %d seconds.' % seconds
494+ amulet.raise_status(amulet.SKIP, msg=error_message)
495+except:
496+ # Something else has gone wrong, raise the error so we can see it and this
497+ # will automatically "FAIL" the test.
498+ raise
499+
500+# Access the Ubuntu instance to ensure it has been deployed correctly
501+
502+# Define the commands to be ran
503+lsb_release_command = 'cat /etc/lsb-release'
504+uname_command = 'uname -a'
505+
506+# Cat the release information
507+output, code = d.sentry.unit['ubuntu/0'].run(lsb_release_command)
508+# Confirm the lsb-release command was ran successfully
509+if (code != 0):
510+ error_message = 'The ' + lsb_release_command + ' did not return the expected return code of 0.'
511+ print(output)
512+ amulet.raise_status(amulet.FAIL, msg=error_message)
513+else:
514+ message = 'The lsb-release command successfully executed.'
515+ print(output)
516+ print(message)
517+
518+# Get the uname -a output
519+output, code = d.sentry.unit['ubuntu/0'].run(uname_command)
520+# Confirm the uname command was ran successfully
521+if (code != 0):
522+ error_message = 'The ' + uname_command + ' did not return the expected return code of 0.'
523+ print(output)
524+ amulet.raise_status(amulet.FAIL, msg=error_message)
525+else:
526+ message = 'The uname command successfully executed.'
527+ print(output)
528+ print(message)

Subscribers

People subscribed via source and target branches