This is an automated email from the ASF dual-hosted git repository. clewolff pushed a commit to branch storage-minio-integration-tests in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit ce651a5fb3bc8d18f215d69f82dfc9c01b42676d Author: Clemens Wolff <[email protected]> AuthorDate: Sun May 2 11:23:19 2021 -0400 Add integration tests for MinIO --- integration/storage/base.py | 13 ++++++++---- integration/storage/test_minio.py | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/integration/storage/base.py b/integration/storage/base.py index 119e8b1..56786cd 100644 --- a/integration/storage/base.py +++ b/integration/storage/base.py @@ -139,15 +139,18 @@ class Integration: self.driver.delete_object(obj) # check that a missing file can't be deleted or looked up - with self.assertRaises(types.ObjectDoesNotExistError): - self.driver.delete_object(obj) - with self.assertRaises(types.ObjectDoesNotExistError): - self.driver.get_object(container.name, blob_name) + self.assert_file_is_missing(container, obj) # check that the file is deleted blobs = self.driver.list_container_objects(container) self.assertEqual([blob.name for blob in blobs], [blob_name[::-1]]) + def assert_file_is_missing(self, container, obj): + with self.assertRaises(types.ObjectDoesNotExistError): + self.driver.delete_object(obj) + with self.assertRaises(types.ObjectDoesNotExistError): + self.driver.get_object(container.name, obj.name) + def test_objects(self, size=1 * MB): def do_upload(container, blob_name, content): infile = self._create_tempfile(content=content) @@ -285,6 +288,7 @@ class Integration: image = None version = 'latest' environment = {} + command = None ready_message = None host = 'localhost' @@ -312,6 +316,7 @@ class Integration: cls.container = cls.client.containers.run( '{}:{}'.format(cls.image, cls.version), + command=cls.command, detach=True, auto_remove=True, ports={cls.port: cls.port}, diff --git a/integration/storage/test_minio.py b/integration/storage/test_minio.py new file mode 100644 index 0000000..a6d9af5 --- /dev/null +++ b/integration/storage/test_minio.py @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the 'License'); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import unittest + +from integration.storage.base import Integration +from libcloud.storage import types + + +class MinioTest(Integration.ContainerTestBase): + provider = 'minio' + + account = 'minioaccount' + secret = 'miniopassword' + + image = 'minio/minio' + port = 9000 + environment = {'MINIO_ROOT_USER': account, 'MINIO_ROOT_PASSWORD': secret} + command = ['server', '/data'] + ready_message = b'IAM initialization complete' + + def test_cdn_url(self): + self.skipTest('Not implemented in driver') + + def assert_file_is_missing(self, container, obj): + with self.assertRaises(types.ObjectDoesNotExistError): + self.driver.get_object(container.name, obj.name) + + +if __name__ == '__main__': + sys.exit(unittest.main())
