Skip to content

Commit 608842a

Browse files
committed
test to verify failed lock acquisition fix
1 parent 1fdcb5c commit 608842a

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

test/functional/material_providers/store/test_meta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""Integration tests for ``dynamodb_encryption_sdk.material_providers.store.meta``."""
13+
"""Functional tests for ``dynamodb_encryption_sdk.material_providers.store.meta``."""
1414
import base64
1515
import os
1616

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Functional tests for ``dynamodb_encryption_sdk.material_providers.most_recent``."""
14+
from mock import MagicMock, sentinel
15+
import pytest
16+
17+
from dynamodb_encryption_sdk.material_providers.most_recent import MostRecentProvider
18+
from dynamodb_encryption_sdk.material_providers.store import ProviderStore
19+
20+
pytestmark = [pytest.mark.functional, pytest.mark.local]
21+
22+
23+
def test_failed_lock_acquisition():
24+
store = MagicMock(__class__=ProviderStore)
25+
provider = MostRecentProvider(
26+
provider_store=store,
27+
material_name='my material',
28+
version_ttl=10.0
29+
)
30+
provider._version = 9
31+
provider._cache.put(provider._version, sentinel.nine)
32+
33+
with provider._lock:
34+
test = provider._get_most_recent_version(allow_local=True)
35+
36+
assert test is sentinel.nine
37+
assert not store.mock_calls

0 commit comments

Comments
 (0)