Package: python-glance-store
Version: 0.1.8-1
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu utopic ubuntu-patch

Dear Maintainer,

   We want to sync python-glance-store into Ubuntu but that is being prevented
   by failing tests.

   I've updated the package and tests now run 100% successfully with the fixes.

In Ubuntu, the attached patch was applied to achieve the following:

  * New upstream release.
  * debian/control: Add python-mox to Build-Depends-Indep to fix test failure.
  * debian/p/fix-tests.patch: Added temporary patch to fix test failures.
  * debian/watch: Update package path.


Thanks for considering the patch!

Corey Bryant


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 
'trusty'), (100, 'trusty-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-35-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== removed file '.gitignore'
--- .gitignore	2014-09-05 10:54:04 +0000
+++ .gitignore	1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
-*~
-*.pyc
-*.dat
-TAGS
-*.egg-info
-*.egg
-build
-.coverage
-.tox
-cover
-venv
-.venv
-output.xml
-*.sublime-workspace
-*.sqlite
-*.html
-.*.swp
-.DS_Store
-.testrepository
-versioninfo
-var/*
-ChangeLog
-AUTHORS

=== removed file '.gitreview'
--- .gitreview	2014-09-05 10:54:04 +0000
+++ .gitreview	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-[gerrit]
-host=review.openstack.org
-port=29418
-project=openstack/glance_store.git

=== modified file '.pc/applied-patches'
--- .pc/applied-patches	2014-09-05 10:54:04 +0000
+++ .pc/applied-patches	2014-09-18 15:12:35 +0000
@@ -0,0 +1 @@
+fix-tests.patch

=== added file 'AUTHORS'
--- AUTHORS	1970-01-01 00:00:00 +0000
+++ AUTHORS	2014-09-18 15:11:41 +0000
@@ -0,0 +1,3 @@
+Andreas Jaeger <[email protected]>
+Flavio Percoco <[email protected]>
+Jeremy Stanley <[email protected]>

=== added file 'ChangeLog'
--- ChangeLog	1970-01-01 00:00:00 +0000
+++ ChangeLog	2014-09-18 15:11:41 +0000
@@ -0,0 +1,110 @@
+CHANGES
+=======
+
+0.1.8
+-----
+
+* Align swift's store API
+
+0.1.7
+-----
+
+* Add `OPTIONS` attribute to swift.Store function
+
+0.1.5
+-----
+
+* Add missing stores to setup.cfg
+* Set group for DeprecatedOpts
+* Complete random_access for the filesystem store
+
+0.1.3
+-----
+
+* Register store's configs w/o creating instances
+
+0.1.2
+-----
+
+* Add deprecated options support for storage drivers
+* Rename locale files for glance_store rename
+* Update .gitreview for project rename
+
+0.1.1
+-----
+
+* Rename glance.store to glance_store
+* Port of 97882f796c0e8969c606ae723d14b6b443e2e2f9
+* Port of 502be24afa122eef08186001e54c1e1180114ccf
+* Fix collection order issues and unit test failures
+
+0.1.0
+-----
+
+
+0.0.1a2
+-------
+
+* Fix development classifier
+* Imported Translations from Transifex
+* Package glance's package entirely
+
+0.0.1a1
+-------
+
+* Split CHUNKSIZE into WRITE/READ_CHUNKSIZE
+* Port swift store
+* Add validate_location
+* Fix some Exceptions incompatibilities
+* Imported Translations from Transifex
+* Setup for glance.store for translation
+* Set the right classifiers in setup.cfg
+* Remove version string from setup.cfg
+* Add .gitreview to the repo
+* Fix flake8 errors
+* Adopt oslo.i18n
+* Pull multipath support from glance/master
+* Update from oslo-incubator
+* Pass offset and chunk_size to the `get` method
+* Migrate vmware store
+* Move FakeHTTPResponse to a common utils module
+* Removed commented code
+* Remove deprecated _schedule_delayed_delete_from_backend function
+* BugFix: Point to the exceptions module
+* BugFix: define scheme outside the `try` block
+* Add a way to register store options
+* Update functions signatures w/ optional context
+* Remove old scrubber options
+* Move exceptions out of common and add backends.py
+* Use exception
+* Remove dependency on oslo-log
+* Add offset and chunk_size to the get method
+* Migrate the rbd store
+* Use register_store_schemes everywhere
+* Add missing context keyword to the s3 store
+* Migrate cinder store
+* Remove location_strategy, it belongs to Glance
+* S3 store ported
+* Move options registration to __init__
+* GridFS Store
+* Port sheepdog and its test suite
+* Update from oslo-inc and added processutils
+* Fix http store tests
+* Added fake driver, restored base tests, fixed load driver issue
+* Use context when needed
+* Add context=None to http store methods
+* Remove old exceptions
+* HTTP migrated
+* Accept a message keyword in exceptions
+* Filesystem driver restored
+* Move drivers under _driver
+* Added testr
+* Config & Import fixes
+* Move base test to glance/store
+* Deprecate old options, make the list shorter
+* Add glance.store common
+* Add tests w/ some fixes, although they don't run yet
+* Update gitignore
+* Add requirements and testr
+* Add oslo-inc modules
+* Copying from glance

=== added file 'PKG-INFO'
--- PKG-INFO	1970-01-01 00:00:00 +0000
+++ PKG-INFO	2014-09-18 15:11:41 +0000
@@ -0,0 +1,25 @@
+Metadata-Version: 1.1
+Name: glance_store
+Version: 0.1.8
+Summary: OpenStack Image Service Store Library
+Home-page: http://www.openstack.org/
+Author: OpenStack
+Author-email: [email protected]
+License: UNKNOWN
+Description: Glance Store Library
+        =====================
+        
+        Glance's stores library
+        
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 3 - Alpha
+Classifier: Environment :: OpenStack
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Information Technology
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 2.6

=== modified file 'debian/changelog'

=== modified file 'debian/control'
--- debian/control	2014-09-05 10:54:04 +0000
+++ debian/control	2014-09-18 15:13:33 +0000
@@ -17,6 +17,7 @@
                      python-httplib2 (>= 0.7.5),
                      python-iso8601 (>= 0.1.8),
                      python-mock (>= 1.0),
+                     python-mox,
                      python-oslo.config (>= 1.2.0),
                      python-oslo.i18n (>= 0.1.0),
                      python-oslo.vmware (>= 0.4),

=== added directory 'debian/patches'
=== added file 'debian/patches/fix-tests.patch'
--- debian/patches/fix-tests.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/fix-tests.patch	2014-09-18 15:13:10 +0000
@@ -0,0 +1,14 @@
+--- a/glance_store/tests/fakes.py
++++ b/glance_store/tests/fakes.py
+@@ -13,9 +13,10 @@
+ #    License for the specific language governing permissions and limitations
+ #    under the License.
+ 
++from glance_store import driver
+ from glance_store import exceptions
+ 
+ 
+-class UnconfigurableStore(base.Store):
++class UnconfigurableStore(driver.Store):
+     def configure(self):
+         raise exceptions.BadStoreConfiguration()

=== added file 'debian/patches/series'
--- debian/patches/series	1970-01-01 00:00:00 +0000
+++ debian/patches/series	2014-09-18 15:12:35 +0000
@@ -0,0 +1 @@
+fix-tests.patch

=== modified file 'debian/watch'
--- debian/watch	2014-09-05 10:54:04 +0000
+++ debian/watch	2014-09-18 15:11:52 +0000
@@ -1,3 +1,3 @@
 version=3
-http://pypi.python.org/packages/source/g/glance_store glance_store-(.*).tar.gz
+http://pypi.python.org/packages/source/g/glance_store/glance_store-(.*).tar.gz
 

=== added directory 'glance_store.egg-info'
=== added file 'glance_store.egg-info/PKG-INFO'
--- glance_store.egg-info/PKG-INFO	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/PKG-INFO	2014-09-18 15:11:41 +0000
@@ -0,0 +1,25 @@
+Metadata-Version: 1.1
+Name: glance-store
+Version: 0.1.8
+Summary: OpenStack Image Service Store Library
+Home-page: http://www.openstack.org/
+Author: OpenStack
+Author-email: [email protected]
+License: UNKNOWN
+Description: Glance Store Library
+        =====================
+        
+        Glance's stores library
+        
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 3 - Alpha
+Classifier: Environment :: OpenStack
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Information Technology
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 2.6

=== added file 'glance_store.egg-info/SOURCES.txt'
--- glance_store.egg-info/SOURCES.txt	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/SOURCES.txt	2014-09-18 15:11:41 +0000
@@ -0,0 +1,91 @@
+.testr.conf
+AUTHORS
+ChangeLog
+LICENSE
+README.rst
+babel.cfg
+openstack-common.conf
+requirements.txt
+setup.cfg
+setup.py
+test-requirements.txt
+tox.ini
+doc/source/conf.py
+doc/source/index.rst
+glance_store/__init__.py
+glance_store/backend.py
+glance_store/driver.py
+glance_store/exceptions.py
+glance_store/i18n.py
+glance_store/location.py
+glance_store.egg-info/PKG-INFO
+glance_store.egg-info/SOURCES.txt
+glance_store.egg-info/dependency_links.txt
+glance_store.egg-info/entry_points.txt
+glance_store.egg-info/not-zip-safe
+glance_store.egg-info/requires.txt
+glance_store.egg-info/top_level.txt
+glance_store/_drivers/__init__.py
+glance_store/_drivers/cinder.py
+glance_store/_drivers/filesystem.py
+glance_store/_drivers/gridfs.py
+glance_store/_drivers/http.py
+glance_store/_drivers/rbd.py
+glance_store/_drivers/s3.py
+glance_store/_drivers/sheepdog.py
+glance_store/_drivers/vmware_datastore.py
+glance_store/_drivers/swift/__init__.py
+glance_store/_drivers/swift/store.py
+glance_store/_drivers/swift/utils.py
+glance_store/common/__init__.py
+glance_store/common/auth.py
+glance_store/common/config.py
+glance_store/common/utils.py
+glance_store/locale/glance_store-log-critical.pot
+glance_store/locale/glance_store-log-error.pot
+glance_store/locale/glance_store-log-info.pot
+glance_store/locale/glance_store-log-warning.pot
+glance_store/locale/glance_store.pot
+glance_store/locale/de/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/en_AU/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/en_GB/LC_MESSAGES/glance_store-log-critical.po
+glance_store/locale/en_GB/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/es/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/fr/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/it/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/ja/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/ko_KR/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/pt_BR/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/vi_VN/LC_MESSAGES/glance_store-log-error.po
+glance_store/locale/zh_CN/LC_MESSAGES/glance_store-log-error.po
+glance_store/openstack/__init__.py
+glance_store/openstack/common/__init__.py
+glance_store/openstack/common/context.py
+glance_store/openstack/common/excutils.py
+glance_store/openstack/common/fileutils.py
+glance_store/openstack/common/gettextutils.py
+glance_store/openstack/common/importutils.py
+glance_store/openstack/common/jsonutils.py
+glance_store/openstack/common/local.py
+glance_store/openstack/common/log.py
+glance_store/openstack/common/processutils.py
+glance_store/openstack/common/strutils.py
+glance_store/openstack/common/timeutils.py
+glance_store/openstack/common/units.py
+glance_store/tests/__init__.py
+glance_store/tests/base.py
+glance_store/tests/fakes.py
+glance_store/tests/utils.py
+glance_store/tests/etc/glance-swift.conf
+tests/__init__.py
+tests/unit/__init__.py
+tests/unit/test_cinder_store.py
+tests/unit/test_filesystem_store.py
+tests/unit/test_gridfs_store.py
+tests/unit/test_http_store.py
+tests/unit/test_rbd_store.py
+tests/unit/test_s3_store.py
+tests/unit/test_sheepdog_store.py
+tests/unit/test_store_base.py
+tests/unit/test_swift_store.py
+tests/unit/test_vmware_store.py
\ No newline at end of file

=== added file 'glance_store.egg-info/dependency_links.txt'
--- glance_store.egg-info/dependency_links.txt	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/dependency_links.txt	2014-09-18 15:11:41 +0000
@@ -0,0 +1 @@
+

=== added file 'glance_store.egg-info/entry_points.txt'
--- glance_store.egg-info/entry_points.txt	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/entry_points.txt	2014-09-18 15:11:41 +0000
@@ -0,0 +1,21 @@
+[glance_store.drivers]
+cinder = glance_store._drivers.cinder:Store
+file = glance_store._drivers.filesystem:Store
+glance.store.cinder.Store = glance_store._drivers.cinder:Store
+glance.store.filesystem.Store = glance_store._drivers.filesystem:Store
+glance.store.gridfs.Store = glance_store._drivers.gridfs:Store
+glance.store.http.Store = glance_store._drivers.http:Store
+glance.store.rbd.Store = glance_store._drivers.rbd:Store
+glance.store.s3.Store = glance_store._drivers.s3:Store
+glance.store.sheepdog.Store = glance_store._drivers.sheepdog:Store
+glance.store.swift.Store = glance_store._drivers.swift:Store
+glance.store.vmware_datastore.Store = glance_store._drivers.vmware_datastore:Store
+gridfs = glance_store._drivers.gridfs:Store
+http = glance_store._drivers.http:Store
+no_conf = glance_store.tests.fakes:UnconfigurableStore
+rbd = glance_store._drivers.rbd:Store
+s3 = glance_store._drivers.s3:Store
+sheepdog = glance_store._drivers.sheepdog:Store
+swift = glance_store._drivers.swift:Store
+vmware = glance_store._drivers.vmware_datastore:Store
+

=== added file 'glance_store.egg-info/not-zip-safe'
--- glance_store.egg-info/not-zip-safe	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/not-zip-safe	2014-09-18 15:11:41 +0000
@@ -0,0 +1 @@
+

=== added file 'glance_store.egg-info/requires.txt'
--- glance_store.egg-info/requires.txt	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/requires.txt	2014-09-18 15:11:41 +0000
@@ -0,0 +1,7 @@
+oslo.config>=1.2.0
+oslo.i18n>=0.1.0
+stevedore>=0.12
+python-cinderclient>=1.0.6
+eventlet>=0.13.0
+iso8601>=0.1.8
+six>=1.4.1

=== added file 'glance_store.egg-info/top_level.txt'
--- glance_store.egg-info/top_level.txt	1970-01-01 00:00:00 +0000
+++ glance_store.egg-info/top_level.txt	2014-09-18 15:11:41 +0000
@@ -0,0 +1 @@
+glance_store

=== modified file 'glance_store/_drivers/filesystem.py'
--- glance_store/_drivers/filesystem.py	2014-09-05 10:54:04 +0000
+++ glance_store/_drivers/filesystem.py	2014-09-18 15:11:41 +0000
@@ -88,10 +88,13 @@
     something that can iterate over a large file
     """
 
-    def __init__(self, filepath, chunk_size=None):
+    def __init__(self, filepath, offset=0, chunk_size=None, partial=False):
+        self.partial = partial
         self.filepath = filepath
         self.chunk_size = chunk_size
         self.fp = open(self.filepath, 'rb')
+        if offset:
+            self.fp.seek(offset)
 
     def __iter__(self):
         """Return an iterator over the image file"""
@@ -101,6 +104,9 @@
                     chunk = self.fp.read(self.chunk_size)
                     if chunk:
                         yield chunk
+
+                        if self.partial:
+                            break
                     else:
                         break
         finally:
@@ -315,7 +321,9 @@
         msg = _("Found image at %s. Returning in ChunkedFile.") % filepath
         LOG.debug(msg)
         return (ChunkedFile(filepath,
-                            chunk_size=chunk_size or self.READ_CHUNKSIZE),
+                            offset=offset,
+                            chunk_size=chunk_size or self.READ_CHUNKSIZE,
+                            partial=chunk_size is not None),
                 filesize)
 
     def get_size(self, location, context=None):

=== modified file 'glance_store/_drivers/swift/store.py'
--- glance_store/_drivers/swift/store.py	2014-09-05 10:54:04 +0000
+++ glance_store/_drivers/swift/store.py	2014-09-18 15:11:41 +0000
@@ -349,6 +349,8 @@
         return MultiTenantStore(conf)
     return SingleTenantStore(conf)
 
+Store.OPTIONS = _SWIFT_OPTS
+
 
 class BaseStore(driver.Store):
 
@@ -401,7 +403,7 @@
             reason = (_("Location credentials are invalid"))
             raise exceptions.BadStoreUri(message=reason)
 
-    def get(self, location, connection=None, context=None):
+    def get(self, location, connection=None, offset=0, chunk_size=None, context=None):
         location = location.store_location
         (resp_headers, resp_body) = self._get_object(location, connection,
                                                      context=context)

=== modified file 'glance_store/_drivers/swift/utils.py'
--- glance_store/_drivers/swift/utils.py	2014-09-05 10:54:04 +0000
+++ glance_store/_drivers/swift/utils.py	2014-09-18 15:11:41 +0000
@@ -51,7 +51,10 @@
 
 
 CONF = cfg.CONF
-CONF.register_opts(swift_opts, group='glance_store')
+for opt in swift_opts:
+    opt.deprecated_opts = [cfg.DeprecatedOpt(opt.name,
+                                             group='DEFAULT')]
+    CONF.register_opt(opt, group='glance_store')
 
 
 def is_multiple_swift_store_accounts_enabled():

=== modified file 'glance_store/backend.py'
--- glance_store/backend.py	2014-09-05 10:54:04 +0000
+++ glance_store/backend.py	2014-09-18 15:11:41 +0000
@@ -27,8 +27,8 @@
 LOG = logging.getLogger(__name__)
 
 _DEPRECATED_STORE_OPTS = [
-    cfg.DeprecatedOpt('known_stores'),
-    cfg.DeprecatedOpt('default_store')
+    cfg.DeprecatedOpt('known_stores', group='DEFAULT'),
+    cfg.DeprecatedOpt('default_store', group='DEFAULT')
 ]
 
 _STORE_OPTS = [
@@ -58,9 +58,14 @@
 
 def register_store_opts(conf):
     for store_entry in set(conf.glance_store.stores):
+        LOG.debug("Registering options for %s" % store_entry)
         store_cls = _load_store(conf, store_entry, False)
 
-        if store_cls.OPTIONS is not None:
+        if store_cls is None:
+            msg = _('Store %s not found') % store_entry
+            raise exceptions.GlanceStoreException(message=msg)
+
+        if getattr(store_cls, 'OPTIONS', None) is not None:
             # NOTE(flaper87): To be removed in k-2. This should
             # give deployers enough time to migrate their systems
             # and move configs under the new section.

=== modified file 'glance_store/tests/fakes.py'
--- glance_store/tests/fakes.py	2014-09-05 10:54:04 +0000
+++ glance_store/tests/fakes.py	2014-09-18 15:13:08 +0000
@@ -13,9 +13,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from glance_store import driver
 from glance_store import exceptions
 
 
-class UnconfigurableStore(base.Store):
+class UnconfigurableStore(driver.Store):
     def configure(self):
         raise exceptions.BadStoreConfiguration()

=== modified file 'setup.cfg'
--- setup.cfg	2014-09-05 10:54:04 +0000
+++ setup.cfg	2014-09-18 15:11:41 +0000
@@ -1,36 +1,50 @@
 [metadata]
 name = glance_store
 summary = OpenStack Image Service Store Library
-description-file =
-    README.rst
+description-file = 
+	README.rst
 author = OpenStack
 author-email = [email protected]
 home-page = http://www.openstack.org/
-classifier =
-    Development Status :: 3 - Alpha
-    Environment :: OpenStack
-    Intended Audience :: Developers
-    Intended Audience :: Information Technology
-    License :: OSI Approved :: Apache Software License
-    Operating System :: POSIX :: Linux
-    Programming Language :: Python
-    Programming Language :: Python :: 2
-    Programming Language :: Python :: 2.7
-    Programming Language :: Python :: 2.6
+classifier = 
+	Development Status :: 3 - Alpha
+	Environment :: OpenStack
+	Intended Audience :: Developers
+	Intended Audience :: Information Technology
+	License :: OSI Approved :: Apache Software License
+	Operating System :: POSIX :: Linux
+	Programming Language :: Python
+	Programming Language :: Python :: 2
+	Programming Language :: Python :: 2.7
+	Programming Language :: Python :: 2.6
 
 [files]
-packages =
-    glance_store
+packages = 
+	glance_store
 
 [entry_points]
-glance_store.drivers =
-    file = glance_store._drivers.filesystem:Store
-    http = glance_store._drivers.http:Store
-    swift = glance_store._drivers.swift:Store
-    vmware = glance_store._drivers.vmware_datastore:Store
-
-    # TESTS ONLY
-    no_conf = glance_store.tests.fakes:UnconfigurableStore
+glance_store.drivers = 
+	file = glance_store._drivers.filesystem:Store
+	http = glance_store._drivers.http:Store
+	swift = glance_store._drivers.swift:Store
+	rbd = glance_store._drivers.rbd:Store
+	s3 = glance_store._drivers.s3:Store
+	sheepdog = glance_store._drivers.sheepdog:Store
+	cinder = glance_store._drivers.cinder:Store
+	gridfs = glance_store._drivers.gridfs:Store
+	vmware = glance_store._drivers.vmware_datastore:Store
+	# TESTS ONLY
+	no_conf = glance_store.tests.fakes:UnconfigurableStore
+	# Backwards compatibility
+	glance.store.filesystem.Store = glance_store._drivers.filesystem:Store
+	glance.store.http.Store = glance_store._drivers.http:Store
+	glance.store.swift.Store = glance_store._drivers.swift:Store
+	glance.store.rbd.Store = glance_store._drivers.rbd:Store
+	glance.store.s3.Store = glance_store._drivers.s3:Store
+	glance.store.sheepdog.Store = glance_store._drivers.sheepdog:Store
+	glance.store.cinder.Store = glance_store._drivers.cinder:Store
+	glance.store.gridfs.Store = glance_store._drivers.gridfs:Store
+	glance.store.vmware_datastore.Store = glance_store._drivers.vmware_datastore:Store
 
 [build_sphinx]
 source-dir = doc/source
@@ -53,3 +67,9 @@
 keywords = _ gettext ngettext l_ lazy_gettext
 mapping_file = babel.cfg
 output_file = glance_store/locale/glance_store.pot
+
+[egg_info]
+tag_build = 
+tag_svn_revision = 0
+tag_date = 0
+

=== modified file 'tests/unit/test_filesystem_store.py'
--- tests/unit/test_filesystem_store.py	2014-09-05 10:54:04 +0000
+++ tests/unit/test_filesystem_store.py	2014-09-18 15:11:41 +0000
@@ -82,6 +82,40 @@
         self.assertEqual(expected_data, data)
         self.assertEqual(expected_num_chunks, num_chunks)
 
+    def test_get_random_access(self):
+        """Test a "normal" retrieval of an image in chunks."""
+        # First add an image...
+        image_id = str(uuid.uuid4())
+        file_contents = "chunk00000remainder"
+        image_file = StringIO.StringIO(file_contents)
+
+        location, size, checksum, _ = self.store.add(image_id,
+                                                     image_file,
+                                                     len(file_contents))
+
+        # Now read it back...
+        uri = "file:///%s/%s" % (self.test_dir, image_id)
+        loc = get_location_from_uri(uri)
+
+        data = ""
+        for offset in range(len(file_contents)):
+            (image_file, image_size) = self.store.get(loc,
+                                                      offset=offset,
+                                                      chunk_size=1)
+            for chunk in image_file:
+                data += chunk
+
+        self.assertEqual(data, file_contents)
+
+        data = ""
+        (image_file, image_size) = self.store.get(loc,
+                                                  offset=5,
+                                                  chunk_size=5)
+        for chunk in image_file:
+            data += chunk
+
+        self.assertEqual(data, '00000')
+
     def test_get_non_existing(self):
         """
         Test that trying to retrieve a file that doesn't exist

Reply via email to