Skip to content

Commit 27d9b60

Browse files
committed
refactor: convert tests to use unittest and add adjust testing pipeline
1 parent c784a55 commit 27d9b60

File tree

3 files changed

+317
-283
lines changed

3 files changed

+317
-283
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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: |

scripts/object_storage_cleaner/README.MD

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff 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
```

0 commit comments

Comments
 (0)