Listing all buckets do not work on Gitlab CI #3502
Describe the bugI want to make functional tests for my S3-dependent app. To that end, I deploy a local minio docker image and I define a pytest fixture creating a bucket if missing. This works on my local laptop, but not on Gitlab CI. Expected BehaviorI expect my pytest fixture to look if the desired bucket exists. Current BehaviorHere are the gitlab CI logs: Reproduction StepsHere is the full minimal example. Required packages boto3 and pytest for python File contents File File File ** To test locally** Run To test on gitlab CI The problem is that a gitlab CI runner is required. Possible SolutionNo idea :( Additional Information/ContextTo launch a gitlab instance with runner, I found that docker-compose file. To get the Yes, that's complicated. SDK version usedboto3==1.24.27 Environment details (OS name and version, etc.)Xubuntu 20.04 and GitLab Community Edition 13.9.7 |
Replies: 9 comments
|
Hi @etienne-monier, Looking at your pytest output, you're passing in a BUCKET_NAME of Look at the |
|
I saw this strange error. This is hardcoded in |
|
To make sure we're looking at the correct failure point, can you change the code to the following and report the stack trace for the failure. # Create bucket
+ current_bucket = 3.Bucket(BUCKET_NAME)
+ all_buckets = s3.buckets.all() # This calls list_buckets under the hood
- if s3.Bucket(BUCKET_NAME) not in s3.buckets.all():
+ if current_bucket not in all_buckets:
s3.create_bucket(Bucket=BUCKET_NAME)The only other case I can see us hitting this code path is if the configured test endpoint is returning an invalid response, causing the list buckets response to attempt creating bucket instances without a name ( |
|
Here are the logs for the modified code: |
|
Thanks for checking, so this is the response from the Minio server. It's not returning valid contents for our list buckets call that is invoked by I'm not sure there's much we can do in this case, you may need to reach out to Minio to understand their response format and determine where they may be deviating from S3. |
|
Ok, after some searches, the problem comes from my company proxy. The problem is that it seems boto3 does not catch The solution is to modify the test module into I finally don't know if this is desired. Let me know. |
|
Hi @etienne-monier - Just checking in here to see if you've found a workaround or solution to this. Please let us know if there's anything else we could assist you further. |
|
The workaround was given in my previous comment. That's to explicitly tell boto3 not to consider proxies. This is due to non-considering |
|
Here is the boto3 documentation on proxies for more reference: https://boto3.amazonaws.com/v1/documentation/api/1.18.55/guide/configuration.html#using-proxies We are now converting guidance issues to GitHub Discussions so I will convert this issue. Please let us know if you had any additional feedback on this. |
Here is the boto3 documentation on proxies for more reference: https://boto3.amazonaws.com/v1/documentation/api/1.18.55/guide/configuration.html#using-proxies
We are now converting guidance issues to GitHub Discussions so I will convert this issue. Please let us know if you had any additional feedback on this.