Merge lp:~cprov/uci-engine/test-image-store into lp:uci-engine

Proposed by Celso Providelo
Status: Merged
Approved by: Francis Ginther
Approved revision: 636
Merged at revision: 643
Proposed branch: lp:~cprov/uci-engine/test-image-store
Merge into: lp:uci-engine
Diff against target: 125 lines (+67/-9)
5 files modified
ci-utils/ci_utils/image_store/__init__.py (+20/-8)
image-builder/setup.py (+1/-0)
setup.sh (+1/-1)
tests/test_image_store.py (+42/-0)
tests/test_test_runner.py (+3/-0)
To merge this branch: bzr merge lp:~cprov/uci-engine/test-image-store
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andy Doan (community) Approve
Francis Ginther Pending
Review via email: mp+224996@code.launchpad.net

Commit message

Adding an integration test for probing credential capabilities for IBS.

Description of the change

Adding an integration test for probing credential capabilities for IBS.

IBS requires credentials able to upload/register new images to the available Glance service. It requires pyOpenSSL dependencies (added to .deps in a separated branch).

This is a preparation step for splitting credentials for Airline & Testbed.

Also adds a minor fix to the test_runner integration test (needs exposed rabbit).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:634
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/974/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/974/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Celso Providelo (cprov) wrote :

Only fails because the lack of PIP dependencies being added by https://code.launchpad.net/~cprov/uci-engine/pyopenssl-for-glanceclient

Revision history for this message
Andy Doan (doanac) wrote :

just a nitpick and a question

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

Thanks for the review, comments replied inline.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:635
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/991/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/991/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:636
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/993/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/993/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Celso Providelo (cprov) wrote :

Francis,

Can we have libffi-dev installed in s-jenkins env for uci-engine ? it's needed for installing pyOpenSSL inside our venv and probe glance capabilities in our integration-tests.

Revision history for this message
Andy Doan (doanac) wrote :

+1, thanks,

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:636
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/998/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/998/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

> Francis,
>
> Can we have libffi-dev installed in s-jenkins env for uci-engine ? it's needed
> for installing pyOpenSSL inside our venv and probe glance capabilities in our
> integration-tests.

I've updated the chroot and it's now running.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:636
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/999/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/999/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:636
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1002/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1002/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :

The attempt to merge lp:~cprov/uci-engine/test-image-store into lp:uci-engine failed. Below is the output from the failed tests.

dpkg is /usr/bin/dpkg
Required packages are missing. Please ensure that the missing packages are installed.
Run: sudo apt-get install build-essential python-pip python-virtualenv python-setuptools python-dev make python-apt-dev libffi-dev

Revision history for this message
Francis Ginther (fginther) wrote :

Dependency added to tarmac host. Lets try this again.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ci-utils/ci_utils/image_store/__init__.py'
2--- ci-utils/ci_utils/image_store/__init__.py 2014-07-01 20:49:09 +0000
3+++ ci-utils/ci_utils/image_store/__init__.py 2014-07-02 04:26:47 +0000
4@@ -58,16 +58,28 @@
5 password=config['auth_password'],
6 tenant_name=config['auth_tenant_name']
7 )
8- except (KeyError, ksclient.exceptions.Unauthorized,
9- ksclient.exceptions.AuthorizationFailure):
10+ except KeyError as exc:
11+ raise ImageStoreException(
12+ "Missing authentication info: {}".format(exc.message))
13+ except (ksclient.exceptions.Unauthorized,
14+ ksclient.exceptions.AuthorizationFailure) as exc:
15 logging.exception('Unable to connect keystone')
16- raise self.ImageStoreException(
17- "Missing or invalid authentication info."
18- )
19+ raise ImageStoreException(
20+ "Unable to contact keystone in {} ({})".format(
21+ config['auth_url'], exc.message))
22
23 def image_create(self, filename, image, is_public=False,
24 disk_format='qcow2', container_format='bare'):
25 with open(image) as imgdata:
26- self.glance.images.create(
27- name=filename, is_public=is_public, disk_format=disk_format,
28- container_format=container_format, data=imgdata)
29+ try:
30+ image = self.glance.images.create(
31+ name=filename,
32+ is_public=is_public,
33+ disk_format=disk_format,
34+ container_format=container_format,
35+ data=imgdata)
36+ except glanceclient.exc.HTTPException as exc:
37+ raise ImageStoreException(
38+ "Unable to create an image in {} ({})".format(
39+ self.glance.endpoint, str(exc)))
40+ return image
41
42=== modified file 'image-builder/setup.py'
43--- image-builder/setup.py 2014-06-18 04:04:04 +0000
44+++ image-builder/setup.py 2014-07-02 04:26:47 +0000
45@@ -18,6 +18,7 @@
46 import sys
47
48 requires = [
49+ 'pyOpenSSL==0.14',
50 'PyYAML==3.10',
51 'amqplib==1.0.0',
52 'launchpadlib==1.10.2',
53
54=== modified file 'setup.sh'
55--- setup.sh 2014-06-24 09:18:12 +0000
56+++ setup.sh 2014-07-02 04:26:47 +0000
57@@ -20,7 +20,7 @@
58 # For OSX, see http://kaspermunck.github.io/2014/03/fixing-clang-error/
59 export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
60
61-pkgs='build-essential python-pip python-virtualenv python-setuptools python-dev make python-apt-dev'
62+pkgs='build-essential python-pip python-virtualenv python-setuptools python-dev make python-apt-dev libffi-dev'
63 if type dpkg 2>/dev/null && ! dpkg -s $pkgs 2>/dev/null >/dev/null ; then
64 echo "Required packages are missing. Please ensure that the missing packages are installed."
65 echo "Run: sudo apt-get install $pkgs"
66
67=== added file 'tests/test_image_store.py'
68--- tests/test_image_store.py 1970-01-01 00:00:00 +0000
69+++ tests/test_image_store.py 2014-07-02 04:26:47 +0000
70@@ -0,0 +1,42 @@
71+#!/usr/bin/env python
72+# Ubuntu Continuous Integration Engine
73+# Copyright 2014 Canonical Ltd.
74+
75+# This program is free software: you can redistribute it and/or modify it
76+# under the terms of the GNU Affero General Public License version 3, as
77+# published by the Free Software Foundation.
78+
79+# This program is distributed in the hope that it will be useful, but
80+# WITHOUT ANY WARRANTY; without even the implied warranties of
81+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
82+# PURPOSE. See the GNU Affero General Public License for more details.
83+
84+# You should have received a copy of the GNU Affero General Public License
85+# along with this program. If not, see <http://www.gnu.org/licenses/>.
86+"""Check ImageStore features in an existing deployment."""
87+import os
88+import tempfile
89+import unittest
90+
91+from ci_utils import unit_config
92+from ci_utils.image_store import ImageStore
93+
94+
95+class ImageStoreTest(unittest.TestCase):
96+
97+ def test_image_creation(self):
98+ # `ImageStore.image_create` is capable of uploading an arbitrary
99+ # image to the available Glance server. This is how the Image-Builder
100+ # publishes a testing image to the Test-Runner.
101+ _fd, image_path = tempfile.mkstemp()
102+ self.addCleanup(os.remove, image_path)
103+ open(image_path, 'w').write('I can haz image ...')
104+ config = unit_config.get_auth_config()
105+
106+ glance = ImageStore(config)
107+ image = glance.image_create('ci-airline-testing.img', image_path)
108+ self.assertEquals('active', image.status)
109+
110+
111+if __name__ == "__main__":
112+ unittest.main()
113
114=== modified file 'tests/test_test_runner.py'
115--- tests/test_test_runner.py 2014-06-25 09:48:37 +0000
116+++ tests/test_test_runner.py 2014-07-02 04:26:47 +0000
117@@ -61,6 +61,9 @@
118 units = status['services']['ci-airline-rabbit']['units']
119 self.unit = 'ci-airline-rabbit/0'
120 self.public_ip = units[self.unit]['public-address']
121+ # Expose rabbit service for this test.
122+ deployers.juju_expose(RABBIT_SERVICE)
123+ self.addCleanup(deployers.juju_expose, RABBIT_SERVICE, False)
124
125 class AmqpConfig(object):
126

Subscribers

People subscribed via source and target branches