You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2021/05/07 01:57:35 UTC

[GitHub] [libcloud] c-w opened a new pull request #1580: Add integration tests for S3 storage driver

c-w opened a new pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580


   ## Add integration tests for S3 storage driver
   
   ### Description
   
   This pull request adds integration tests for the S3 storage driver.
   
   Given that there are existing buckets in the test AWS account, this pull request also updates the base tests to ignore any containers that weren't created as part of the test.
   
   Unlike for Azure and MinIO, on S3, `create_container` for an already existing container seems to not throw `ContainerAlreadyExistsError` so the assertion has been disabled in this driver's test suite.
   
   ### Status
   
   - done, ready for review
   
   ### Checklist (tick everything that applies)
   
   - [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
   - [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
   - [x] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] codecov-commenter commented on pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#issuecomment-834003175


   # [Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1580](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (305d680) into [trunk](https://codecov.io/gh/apache/libcloud/commit/fcab0c604a61c931565704fdd5006609e37cffec?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fcab0c6) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/libcloud/pull/1580/graphs/tree.svg?width=650&height=150&src=pr&token=PYoduksh69&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@           Coverage Diff           @@
   ##            trunk    #1580   +/-   ##
   =======================================
     Coverage   83.01%   83.01%           
   =======================================
     Files         394      394           
     Lines       84999    84999           
     Branches     9040     9040           
   =======================================
     Hits        70558    70558           
     Misses      11374    11374           
     Partials     3067     3067           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [fcab0c6...305d680](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
Kami commented on pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#issuecomment-834595410


   I see the overall integration tests duration is ~14 minutes and ``test_objects_stream_iterable`` takes ~ 90 seconds.
   
   Is there any way we could speed that up a bit? E.g. use a smaller object for that test or similar. Or we are intentionally testing large object size and we can't avoid slower duration?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
Kami commented on pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#issuecomment-834596888


   > Unlike for Azure and MinIO, on S3, create_container for an already existing container seems to not throw ContainerAlreadyExistsError so the assertion has been disabled in this driver's test suite. In the future we may want to consider fixing all these minor inconsistencies that are brought to light by the tests.
   
   Yeah I agree, this seems like something we should eventually fix for consistency across drivers. Please feel free to open an issue for it if you get a chance.
   
   On that note, what is the current behavior? It just returns an existing container with that name?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] codecov-commenter edited a comment on pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#issuecomment-834003175


   # [Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1580](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9311c7e) into [trunk](https://codecov.io/gh/apache/libcloud/commit/fcab0c604a61c931565704fdd5006609e37cffec?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fcab0c6) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/libcloud/pull/1580/graphs/tree.svg?width=650&height=150&src=pr&token=PYoduksh69&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@           Coverage Diff           @@
   ##            trunk    #1580   +/-   ##
   =======================================
     Coverage   83.01%   83.01%           
   =======================================
     Files         394      394           
     Lines       84999    84999           
     Branches     9040     9040           
   =======================================
     Hits        70558    70558           
     Misses      11374    11374           
     Partials     3067     3067           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [fcab0c6...9311c7e](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] c-w commented on a change in pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
c-w commented on a change in pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#discussion_r628638877



##########
File path: integration/storage/test_s3.py
##########
@@ -0,0 +1,78 @@
+# 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 os
+import sys
+import unittest
+
+try:
+    import boto3
+except ImportError:
+    boto3 = None
+
+from integration.storage.base import Integration
+from libcloud.storage import types
+
+
+class S3Test(Integration.TestBase):
+    provider = 's3'
+
+    @classmethod
+    def setUpClass(cls):
+        if boto3 is None:
+            raise unittest.SkipTest('missing boto3 library')
+
+        config = {
+            key: os.getenv(key)
+            for key in (
+                'AWS_ACCESS_KEY_ID',
+                'AWS_ACCESS_KEY_SECRET',
+            )
+        }
+
+        for key, value in config.items():
+            if not value:
+                raise unittest.SkipTest('missing environment variable %s' % key)
+
+        cls.account = config['AWS_ACCESS_KEY_ID']
+        cls.secret = config['AWS_ACCESS_KEY_SECRET']
+
+    @classmethod
+    def tearDownClass(cls):
+        client = boto3.Session(

Review comment:
       I figured that if we have a bug/regression in libcloud, we don't want to keep stray resources around so might as well use the official library to perform the cleanup.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] c-w commented on pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
c-w commented on pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#issuecomment-840897238


   > On that note, what is the current behavior? It just returns an existing container with that name?
   
   Yes, `create_container` on an existing container returns a container with the same properties as the existing one. Here's a repro:
   
   ```py
   from libcloud.storage.types import Provider
   from libcloud.storage.providers import get_driver
   
   cls = get_driver(Provider.S3)
   driver = cls(AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY_SECRET)
   
   containers = driver.list_containers()
   print(driver.create_container(containers[0].name).name == containers[0].name)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on a change in pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
Kami commented on a change in pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#discussion_r628349756



##########
File path: integration/storage/base.py
##########
@@ -284,6 +292,16 @@ def _create_tempfile(self, prefix='', content=b''):
             self.addCleanup(os.remove, path)
             return path
 
+        @classmethod
+        def _random_container_name(cls):
+            suffix = random_string(cls.container_name_max_length)
+            name = cls.container_name_prefix + suffix

Review comment:
       Yeah, I think including a special prefix on which we can filter on in the "clean up phase" is a good idea.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] c-w merged pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
c-w merged pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] codecov-commenter edited a comment on pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#issuecomment-834003175


   # [Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1580](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (57f794f) into [trunk](https://codecov.io/gh/apache/libcloud/commit/fcab0c604a61c931565704fdd5006609e37cffec?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fcab0c6) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/libcloud/pull/1580/graphs/tree.svg?width=650&height=150&src=pr&token=PYoduksh69&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@           Coverage Diff           @@
   ##            trunk    #1580   +/-   ##
   =======================================
     Coverage   83.01%   83.01%           
   =======================================
     Files         394      394           
     Lines       84999    84999           
     Branches     9040     9040           
   =======================================
     Hits        70558    70558           
     Misses      11374    11374           
     Partials     3067     3067           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [fcab0c6...57f794f](https://codecov.io/gh/apache/libcloud/pull/1580?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on a change in pull request #1580: Add integration tests for S3 storage driver

Posted by GitBox <gi...@apache.org>.
Kami commented on a change in pull request #1580:
URL: https://github.com/apache/libcloud/pull/1580#discussion_r628350477



##########
File path: integration/storage/test_s3.py
##########
@@ -0,0 +1,78 @@
+# 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 os
+import sys
+import unittest
+
+try:
+    import boto3
+except ImportError:
+    boto3 = None
+
+from integration.storage.base import Integration
+from libcloud.storage import types
+
+
+class S3Test(Integration.TestBase):
+    provider = 's3'
+
+    @classmethod
+    def setUpClass(cls):
+        if boto3 is None:
+            raise unittest.SkipTest('missing boto3 library')
+
+        config = {
+            key: os.getenv(key)
+            for key in (
+                'AWS_ACCESS_KEY_ID',
+                'AWS_ACCESS_KEY_SECRET',
+            )
+        }
+
+        for key, value in config.items():
+            if not value:
+                raise unittest.SkipTest('missing environment variable %s' % key)
+
+        cls.account = config['AWS_ACCESS_KEY_ID']
+        cls.secret = config['AWS_ACCESS_KEY_SECRET']
+
+    @classmethod
+    def tearDownClass(cls):
+        client = boto3.Session(

Review comment:
       Just curious why we use boto3 for the clean up phase and not the Libcloud itself?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org