Skip to content

Conversation

@jremy42
Copy link
Contributor

@jremy42 jremy42 commented Oct 30, 2025

close #1077

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Release note for CHANGELOG:


@jremy42 jremy42 requested a review from remyleone as a code owner October 30, 2025 05:21
@jremy42 jremy42 changed the title feat(mongodb): assume UTC for naive expires_at in custom APIs and add… feat(mongodb): assume UTC for naive expires_at in custom APIs Oct 30, 2025
@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
21 1 20 12
View the top 1 failed test(s) by shortest run time
scaleway/mongodb/v1/tests/test_custom_api.py::test_create_snapshot_with_naive_expires_at_vcr
Stack Traces | 0.009s run time
@scw_vcr.use_cassette
    def test_create_snapshot_with_naive_expires_at_vcr() -> None:
        client = initialize_client_test()
        api = MongodbUtilsV1API(client, bypass_validation=True)
    
        # Fixed value to match cassette; record once locally, then CI replays
        instance_id = "00000000-0000-0000-0000-000000000000"
    
        # Naive datetime should be handled as UTC by the utils API
        naive_dt = datetime.now().replace(tzinfo=None) + timedelta(days=1)
    
>       snapshot = api.create_snapshot(
            instance_id=instance_id,
            name="sdk-python-test-snapshot",
            expires_at=naive_dt,
        )

.../v1/tests/test_custom_api.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../mongodb/v1/custom_api.py:27: in create_snapshot
    return super().create_snapshot(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../mongodb/v1/api.py:673: in create_snapshot
    res = self._request(
...../scaleway-core/scaleway_core/api.py:166: in _request
    response = requests.request(
../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11.../site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11....../site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11....../site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11.../site-packages/requests/adapters.py:644: in send
    resp = conn.urlopen(
../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11....../site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self._make_request(
../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11....../site-packages/urllib3/connectionpool.py:534: in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <vcr.patch..../tests/cassettes/test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml object at 0x7f0fed0ebb90>
_ = False, kwargs = {}

    def getresponse(self, _=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self._vcr_request):
            log.info(f"Playing response for {self._vcr_request} from cassette")
            response = self.cassette.play_response(self._vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self._vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self._vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette (PosixPath('.../tests/cassettes/test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml')) in your current record mode ('none').
E               No match for the request (<Request (POST) https://api.scaleway..../regions/fr-par/snapshots>) was found.
E               No similar requests, that have not been played, found.

../../../../..../pypoetry/virtualenvs/scaleway-k9TlsP94-py3.11/lib/python3.11.../vcr/stubs/__init__.py:264: CannotOverwriteExistingCassetteException

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@jremy42 jremy42 force-pushed the fix/mongodb-snapshot-expires-at-utc branch 4 times, most recently from 7a3837f to d545465 Compare November 3, 2025 10:46
@jremy42 jremy42 force-pushed the fix/mongodb-snapshot-expires-at-utc branch from d545465 to 73aa327 Compare November 3, 2025 10:46
@remyleone remyleone added this pull request to the merge queue Nov 4, 2025
Merged via the queue into main with commit 4730b27 Nov 4, 2025
80 checks passed
@remyleone remyleone deleted the fix/mongodb-snapshot-expires-at-utc branch November 4, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MongoDb API: Create Snapshot cannot handle expires_at without timezone information

4 participants