Skip to content

Commit 35bd5be

Browse files
committed
tests: add integration tests for s3
1 parent 4bc29b9 commit 35bd5be

File tree

7 files changed

+97
-41
lines changed

7 files changed

+97
-41
lines changed

integration/main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import asyncio
2+
3+
from .s3 import run as s3_run
4+
5+
async def main():
6+
success = True
7+
8+
try:
9+
# this will test integration with aioboto3
10+
await s3_run()
11+
except Exception as e:
12+
print(f'Error: {e}')
13+
success = False
14+
15+
if not success:
16+
raise Exception('Integration tests failed')
17+
18+
19+
asyncio.run(main())

integration/s3.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
3+
async def run():
4+
from skynet.modules.ttt.s3 import S3
5+
6+
s3 = S3()
7+
8+
file = './test_upload.txt'
9+
# create a test file
10+
with open(file, 'w') as f:
11+
f.write('This is a test file for S3 integration.')
12+
13+
# # # Test upload
14+
await s3.upload_file(file)
15+
16+
# # delete the local test file
17+
os.remove(file)
18+
19+
# # # Test download
20+
await s3.download_file(file)
21+
22+
# # # Check if the file exists after download
23+
if not os.path.exists(file):
24+
raise Exception('Downloaded file does not exist')
25+
26+
# # # Test delete
27+
await s3.delete_file(file)
28+
os.remove(file)
29+
30+
# # # Check if the file is deleted from S3
31+
await s3.download_file(file)
32+
33+
if os.path.exists(file):
34+
raise Exception('File was not deleted from S3')

poetry.lock

Lines changed: 31 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ optional = true
2626
vllm = "0.7.3"
2727

2828
[tool.poetry.dependencies]
29-
aioboto3 = "14.3.0"
29+
aioboto3 = "15.0.0"
3030
aiofiles = "24.1.0"
3131
aiohttp = "3.11.18"
3232
async-lru = "2.0.5"

requirements-vllm.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
aioboto3==14.3.0 ; python_version == "3.11"
2-
aiobotocore==2.22.0 ; python_version == "3.11"
1+
aioboto3==15.0.0 ; python_version == "3.11"
2+
aiobotocore==2.23.0 ; python_version == "3.11"
33
aiofiles==24.1.0 ; python_version == "3.11"
44
aiohappyeyeballs==2.6.1 ; python_version == "3.11"
55
aiohttp==3.11.18 ; python_version == "3.11"
@@ -15,8 +15,8 @@ attrs==25.3.0 ; python_version == "3.11"
1515
av==12.3.0 ; python_version == "3.11"
1616
beautifulsoup4==4.13.4 ; python_version == "3.11"
1717
blake3==1.0.5 ; python_version == "3.11"
18-
boto3==1.37.3 ; python_version == "3.11"
19-
botocore==1.37.3 ; python_version == "3.11"
18+
boto3==1.38.27 ; python_version == "3.11"
19+
botocore==1.38.27 ; python_version == "3.11"
2020
certifi==2025.4.26 ; python_version == "3.11"
2121
cffi==1.17.1 ; python_version == "3.11"
2222
charset-normalizer==3.4.2 ; python_version == "3.11"
@@ -159,7 +159,7 @@ requests==2.32.3 ; python_version == "3.11"
159159
rich-toolkit==0.14.6 ; python_version == "3.11"
160160
rich==14.0.0 ; python_version == "3.11"
161161
rpds-py==0.25.1 ; python_version == "3.11"
162-
s3transfer==0.11.3 ; python_version == "3.11"
162+
s3transfer==0.13.0 ; python_version == "3.11"
163163
safetensors==0.5.3 ; python_version == "3.11"
164164
scikit-learn==1.6.1 ; python_version == "3.11"
165165
scipy==1.15.3 ; python_version == "3.11"

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
aioboto3==14.3.0 ; python_version == "3.11"
2-
aiobotocore==2.22.0 ; python_version == "3.11"
1+
aioboto3==15.0.0 ; python_version == "3.11"
2+
aiobotocore==2.23.0 ; python_version == "3.11"
33
aiofiles==24.1.0 ; python_version == "3.11"
44
aiohappyeyeballs==2.6.1 ; python_version == "3.11"
55
aiohttp==3.11.18 ; python_version == "3.11"
@@ -12,8 +12,8 @@ async-timeout==5.0.1 ; python_version == "3.11" and python_full_version < "3.11.
1212
attrs==25.3.0 ; python_version == "3.11"
1313
av==12.3.0 ; python_version == "3.11"
1414
beautifulsoup4==4.13.4 ; python_version == "3.11"
15-
boto3==1.37.3 ; python_version == "3.11"
16-
botocore==1.37.3 ; python_version == "3.11"
15+
boto3==1.38.27 ; python_version == "3.11"
16+
botocore==1.38.27 ; python_version == "3.11"
1717
certifi==2025.4.26 ; python_version == "3.11"
1818
cffi==1.17.1 ; python_version == "3.11"
1919
charset-normalizer==3.4.2 ; python_version == "3.11"
@@ -112,7 +112,7 @@ redis==6.1.0 ; python_version == "3.11"
112112
regex==2024.11.6 ; python_version == "3.11"
113113
requests-toolbelt==1.0.0 ; python_version == "3.11"
114114
requests==2.32.3 ; python_version == "3.11"
115-
s3transfer==0.11.3 ; python_version == "3.11"
115+
s3transfer==0.13.0 ; python_version == "3.11"
116116
safetensors==0.5.3 ; python_version == "3.11"
117117
scikit-learn==1.6.1 ; python_version == "3.11"
118118
scipy==1.15.3 ; python_version == "3.11"

skynet/modules/ttt/s3.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import aiofiles.os
12
from botocore.config import Config
23

34
from skynet.env import (
@@ -32,6 +33,7 @@ async def download_file(self, filename):
3233
log.info(f'Downloaded file from S3: {filename}')
3334
except Exception as e:
3435
log.error(f'Failed to download file {filename} from S3: {e}')
36+
await aiofiles.os.remove(filename)
3537

3638
async def upload_file(self, filename):
3739
try:

0 commit comments

Comments
 (0)