Skip to content

Commit da49f57

Browse files
committed
final fixing
1 parent d8ed709 commit da49f57

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

.github/workflows/aws-proxy.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ jobs:
6161
pip install awscli-local[ver1]
6262
pip install terraform-local
6363
64-
# Note: Install the same boto3 version as installed in the image. This is a small fix to avoid
65-
# assertion errors (missing `BucketArn` in S3 responses). TODO: to be fixed in a future iteration!
66-
version=$(docker run --entrypoint= --rm localstack/localstack-pro bash -c '. .venv/bin/activate; pip show boto3 | grep Version | cut -d" " -f2')
67-
(. .venv/bin/activate; pip install "boto3==$version")
68-
6964
find /home/runner/.cache/localstack/volume/lib/extensions/python_venv/lib/python3.*/site-packages/aws*
7065
ls -la /home/runner/.cache/localstack/volume/lib/extensions/python_venv/lib/python3.*/site-packages/aws*
7166
DEBUG=1 GATEWAY_SERVER=hypercorn localstack start -d

aws-proxy/tests/proxy/test_s3.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
from aws_proxy.shared.models import ProxyConfig
1313

1414

15+
def _compare_list_buckets_results(
16+
buckets_aws: list, buckets_proxied: list, assert_not_empty=False
17+
):
18+
for bucket in buckets_aws + buckets_proxied:
19+
# TODO: tmp fix - seems like this attribute is missing for certain boto3 versions. To be investigated!
20+
bucket.pop("BucketArn", None)
21+
if assert_not_empty:
22+
assert buckets_aws
23+
assert buckets_proxied == buckets_aws
24+
25+
1526
@pytest.mark.parametrize(
1627
"metadata_gzip",
1728
[
@@ -53,13 +64,13 @@ def _add_header(request, **kwargs):
5364
# list buckets to assert that proxy is up and running
5465
buckets_proxied = s3_client.list_buckets()["Buckets"]
5566
buckets_aws = s3_client_aws.list_buckets()["Buckets"]
56-
assert buckets_proxied == buckets_aws
67+
_compare_list_buckets_results(buckets_aws, buckets_proxied)
5768

5869
# create bucket
5970
bucket = s3_create_bucket()
6071
buckets_proxied = s3_client.list_buckets()["Buckets"]
6172
buckets_aws = s3_client_aws.list_buckets()["Buckets"]
62-
assert buckets_proxied and buckets_proxied == buckets_aws
73+
_compare_list_buckets_results(buckets_aws, buckets_proxied, assert_not_empty=True)
6374

6475
# put object
6576
key = "test-key-with-urlencoded-chars-:+"
@@ -131,7 +142,7 @@ def test_s3_list_objects_in_different_folders(start_aws_proxy, s3_create_bucket)
131142
bucket = s3_create_bucket()
132143
buckets_proxied = s3_client.list_buckets()["Buckets"]
133144
buckets_aws = s3_client_aws.list_buckets()["Buckets"]
134-
assert buckets_proxied and buckets_proxied == buckets_aws
145+
_compare_list_buckets_results(buckets_aws, buckets_proxied, assert_not_empty=True)
135146

136147
# create a couple of objects under different paths/folders
137148
s3_client.put_object(Bucket=bucket, Key="test/foo/bar", Body=b"test")

0 commit comments

Comments
 (0)