Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
test caching via s3
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed Jan 18, 2024
1 parent 1f9c3d0 commit 7202545
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from prefect_aws import AwsCredentials, MinIOCredentials
from prefect_aws.client_parameters import AwsClientParameters
from prefect_aws.credentials import _get_client_cached
from prefect_aws.s3 import (
S3Bucket,
s3_copy,
Expand Down Expand Up @@ -1047,3 +1048,16 @@ def test_move_object_between_buckets(

with pytest.raises(ClientError):
assert s3_bucket_with_object.read_path("object") == b"TEST"

def test_client_is_cached_when_specified(self, aws_creds_block):
s3_bucket = S3Bucket(
bucket_name="bucket", credentials=aws_creds_block, cache_client=True
)

_get_client_cached.cache_clear()

s3_bucket._get_s3_client()
s3_bucket._get_s3_client()

assert _get_client_cached.cache_info().hits == 1
assert _get_client_cached.cache_info().misses == 1

0 comments on commit 7202545

Please sign in to comment.