Add integration tests for S3 storage driver#1580
Conversation
Codecov Report
@@ 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.
|
305d680 to
9311c7e
Compare
9311c7e to
57f794f
Compare
46daf0e to
7ea8b2b
Compare
| @classmethod | ||
| def _random_container_name(cls): | ||
| suffix = random_string(cls.container_name_max_length) | ||
| name = cls.container_name_prefix + suffix |
There was a problem hiding this comment.
Yeah, I think including a special prefix on which we can filter on in the "clean up phase" is a good idea.
|
|
||
| @classmethod | ||
| def tearDownClass(cls): | ||
| client = boto3.Session( |
There was a problem hiding this comment.
Just curious why we use boto3 for the clean up phase and not the Libcloud itself?
There was a problem hiding this 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.
|
I see the overall integration tests duration is ~14 minutes and 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? |
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? |
Yes, 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) |
* Enable tests to work with existing containers * Add integration tests for S3 * Pass secrets to integration tests * Fix error due to missing addClassCleanup
* Enable tests to work with existing containers * Add integration tests for S3 * Pass secrets to integration tests * Fix error due to missing addClassCleanup
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_containerfor an already existing container seems to not throwContainerAlreadyExistsErrorso 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.Status
Checklist (tick everything that applies)