File tree Expand file tree Collapse file tree 3 files changed +317
-283
lines changed
scripts/object_storage_cleaner Expand file tree Collapse file tree 3 files changed +317
-283
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,17 @@ jobs:
127127 run : |
128128 docker compose run app python manage.py test --keepdb -v2 --tag="flaky" qfieldcloud
129129
130+ - name : Run Object Storage Cleaner tests
131+ if : matrix.django_app == 'filestorage' && matrix.storage == 'default'
132+ run : |
133+ docker compose run --rm \
134+ -e AWS_ACCESS_KEY_ID=minioadmin \
135+ -e AWS_SECRET_ACCESS_KEY=minioadmin \
136+ -e AWS_ENDPOINT_URL=http://172.17.0.1:8009 \
137+ -e AWS_DEFAULT_REGION=us-east-1 \
138+ -v ${{ github.workspace }}/scripts:/usr/src/scripts \
139+ app python /usr/src/scripts/object_storage_cleaner/test.py
140+
130141 - name : " failure logs"
131142 if : failure()
132143 run : |
Original file line number Diff line number Diff line change @@ -92,14 +92,11 @@ python object_storage_cleaner.py test-bucket --force
9292
9393## Running Tests
9494
95- The repository includes a test suite (` test.py ` ) that uses ` pytest ` and requires a running S3-compatible service (like MinIO).
95+ The repository includes a test suite (` test.py ` ) that uses ` unittest ` and requires a running S3-compatible service (like MinIO).
9696
9797### Test Requirements
98- - ` pytest `
9998- ` boto3 `
100- - A local S3 service (e.g., MinIO) running. By default, tests expect it at ` http://localhost:8009 ` (us-east-1).
101-
102- * you can also adjust the test file for your needs to connect to a remote object storage server to run the tests*
99+ - S3 service (e.g., MinIO) running.
103100
104101### Steps to Run Tests
105102
@@ -112,10 +109,17 @@ The repository includes a test suite (`test.py`) that uses `pytest` and requires
112109 minio/minio server /data
113110 ```
114111
115- 2. ** Configure Tests (Optional)**
116- If your local S3 is different from ` http://localhost:8009` , update the ` CONNECTION_CONFIG` dictionary in ` test.py` .
112+ 2. ** Configure Environment Variables**
113+ Export the following variables to configure ` boto3` to talk to your local MinIO instance (matching the credentials above):
114+
115+ ` ` ` bash
116+ export AWS_ACCESS_KEY_ID=access_key_xyz
117+ export AWS_SECRET_ACCESS_KEY=secret_key_xyz
118+ export AWS_ENDPOINT_URL=http://localhost:8009
119+ export AWS_DEFAULT_REGION=us-east-1
120+ ` ` `
117121
118- 3. ** Run Pytest **
122+ 3. ** Run Tests **
119123 ` ` ` bash
120- pytest test.py
124+ python test.py
121125 ` ` `
You can’t perform that action at this time.
0 commit comments