Skip to content

Commit 0e8ac10

Browse files
committed
test(mongodb): skip VCR test until cassette exists; add README with record steps
1 parent 7d2b79f commit 0e8ac10

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MongoDB tests (VCR)
2+
3+
This suite uses VCR cassettes to replay HTTP calls in CI.
4+
5+
How to record locally:
6+
7+
1. Ensure you have valid Scaleway credentials exported (access key, secret key, default region).
8+
2. Pick a MongoDB instance to target for snapshot creation.
9+
3. Temporarily replace the fixed `instance_id` in `test_custom_api.py` with your instance id or set breakpoints to inject it.
10+
4. Run the specific test once to record the cassette:
11+
12+
```bash
13+
pytest -k test_create_snapshot_with_naive_expires_at_vcr
14+
```
15+
16+
5. Commit the generated cassette file:
17+
- Path: `scaleway/scaleway/mongodb/v1/tests/cassettes/test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml`
18+
19+
Notes:
20+
- The test will skip in CI if the cassette file is missing.
21+
- After recording, restore the fixed `instance_id` value used by the test to keep requests stable across replays.

scaleway/scaleway/mongodb/v1/tests/test_custom_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime, timedelta, timezone
2+
from pathlib import Path
23

34
import pytest
45

@@ -12,6 +13,12 @@
1213

1314
@scw_vcr.use_cassette
1415
def test_create_snapshot_with_naive_expires_at_vcr() -> None:
16+
cassette = (
17+
Path(__file__).with_name("cassettes")
18+
/ "test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml"
19+
)
20+
if not cassette.exists():
21+
pytest.skip("cassette not recorded yet; record locally then commit it")
1522
client = initialize_client_test()
1623
api = MongodbUtilsV1API(client, bypass_validation=True)
1724

0 commit comments

Comments
 (0)