Skip to content

Commit ffb4ed3

Browse files
committed
fixing CI pipeline binding
1 parent 28bc828 commit ffb4ed3

17 files changed

Lines changed: 113 additions & 177 deletions

sdk/cosmos/azure-cosmos/tests/test_aad.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_test_item(num):
3737

3838
class CosmosEmulatorCredential(object):
3939
def get_token(self, *scopes, **kwargs):
40-
# type: (*str, **Any) -> AccessToken
40+
# type: (*str, **object) -> AccessToken
4141
"""Request an access token for the emulator. Based on Azure Core's Access Token Credential.
4242
4343
This method is called automatically by Azure SDK clients.
@@ -88,7 +88,6 @@ def get_token(self, *scopes, **kwargs):
8888

8989

9090
@pytest.mark.cosmosEmulator
91-
@pytest.mark.cosmosAAD
9291
@pytest.mark.skipif(
9392
not test_config.TestConfig.is_emulator
9493
and test_config.TestConfig.data_auth_mode != 'aad',

sdk/cosmos/azure-cosmos/tests/test_aad_async.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_test_item(num):
3737

3838
class CosmosEmulatorCredential(object):
3939
async def get_token(self, *scopes, **kwargs):
40-
# type: (*str, **Any) -> AccessToken
40+
# type: (*str, **object) -> AccessToken
4141
"""Request an access token for the emulator. Based on Azure Core's Access Token Credential.
4242
4343
This method is called automatically by Azure SDK clients.
@@ -88,7 +88,6 @@ async def get_token(self, *scopes, **kwargs):
8888

8989

9090
@pytest.mark.cosmosEmulator
91-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
9291
class TestAADAsync(unittest.IsolatedAsyncioTestCase):
9392
client: CosmosClient = None
9493
database: DatabaseProxy = None

sdk/cosmos/azure-cosmos/tests/test_auto_scale.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from azure.cosmos import ThroughputProperties, PartitionKey
1313

1414
@pytest.mark.cosmosLong
15-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
1615
class TestAutoScale(unittest.TestCase):
1716
client: CosmosClient = None
1817
key_client: CosmosClient = None

sdk/cosmos/azure-cosmos/tests/test_auto_scale_async.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from azure.cosmos.aio import CosmosClient, DatabaseProxy
1313

1414
@pytest.mark.cosmosLong
15-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
1615
class TestAutoScaleAsync(unittest.IsolatedAsyncioTestCase):
1716
host = test_config.TestConfig.host
1817
masterKey = test_config.TestConfig.masterKey

sdk/cosmos/azure-cosmos/tests/test_change_feed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def round_time():
4545

4646
@pytest.mark.cosmosCircuitBreaker
4747
@pytest.mark.cosmosQuery
48-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
48+
@pytest.mark.cosmosAAD
4949
@pytest.mark.unittest
5050
@pytest.mark.usefixtures("setup")
5151
class TestChangeFeed:
@@ -208,7 +208,7 @@ def create_random_items(container, batch_size):
208208
# Create the item in the container
209209
container.upsert_item(item)
210210
except exceptions.CosmosHttpResponseError as e:
211-
fail(e)
211+
fail(str(e))
212212

213213
# Create first batch of random items
214214
create_random_items(created_collection, batchSize)

sdk/cosmos/azure-cosmos/tests/test_change_feed_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def round_time():
5252

5353
@pytest.mark.cosmosCircuitBreaker
5454
@pytest.mark.cosmosQuery
55-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
55+
@pytest.mark.cosmosAAD
5656
@pytest.mark.asyncio
5757
@pytest.mark.usefixtures("setup")
5858
class TestChangeFeedAsync:
@@ -239,7 +239,7 @@ async def create_random_items(container, batch_size):
239239
await container.upsert_item(item)
240240
created_ids.add(item['id'])
241241
except exceptions.CosmosHttpResponseError as e:
242-
pytest.fail(e)
242+
pytest.fail(str(e))
243243
return created_ids
244244

245245
try:

sdk/cosmos/azure-cosmos/tests/test_crud_database.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def send(self, *args, **kwargs):
4949

5050

5151
@pytest.mark.cosmosLong
52-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
5352
class TestCRUDDatabaseOperations(unittest.TestCase):
5453
"""Python CRUD Tests.
5554
"""

sdk/cosmos/azure-cosmos/tests/test_crud_database_async.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ async def send(self, *args, **kwargs):
4848

4949

5050
@pytest.mark.cosmosLong
51-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
5251
class TestCRUDDatabaseOperationsAsync(unittest.IsolatedAsyncioTestCase):
5352
"""Python CRUD Tests.
5453
"""

sdk/cosmos/azure-cosmos/tests/test_feed_range.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,12 @@ def setup():
2020
"You must specify your Azure Cosmos account values for "
2121
"'masterKey' and 'host' at the top of this class to run the "
2222
"tests.")
23-
# Key-auth client is used for control-plane operations in this test class.
23+
# Single key-auth client is sufficient for this emulator-focused test class.
2424
key_client = cosmos_client.CosmosClient(TestFeedRange.host, test_config.TestConfig.masterKey)
2525
key_db = key_client.get_database_client(TestFeedRange.TEST_DATABASE_ID)
26-
# AAD (or key) client for data-plane operations
27-
data_client = test_config.TestConfig.create_data_client()
28-
created_db = data_client.get_database_client(TestFeedRange.TEST_DATABASE_ID)
2926
return {
3027
"key_db": key_db,
31-
"created_db": created_db,
32-
"created_collection": created_db.get_container_client(TestFeedRange.TEST_CONTAINER_ID)
28+
"created_collection": key_db.get_container_client(TestFeedRange.TEST_CONTAINER_ID)
3329
}
3430

3531
test_subset_ranges = [(Range("", "FF", True, False),
@@ -85,7 +81,6 @@ def setup():
8581
False)]
8682

8783
@pytest.mark.cosmosEmulator
88-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
8984
@pytest.mark.unittest
9085
@pytest.mark.usefixtures("setup")
9186
class TestFeedRange:
@@ -104,8 +99,7 @@ def test_partition_key_to_feed_range(self, setup):
10499
id='container_' + str(uuid.uuid4()),
105100
partition_key=partition_key.PartitionKey(path="/id")
106101
)
107-
# Data-plane proxy for feed_range operations
108-
created_container = setup["created_db"].get_container_client(created_container_ref.id)
102+
created_container = setup["key_db"].get_container_client(created_container_ref.id)
109103
feed_range = created_container.feed_range_from_partition_key("1")
110104
feed_range_epk = FeedRangeInternalEpk.from_json(feed_range)
111105
assert feed_range_epk.get_normalized_range() == Range("3C80B1B7310BB39F29CC4EA05BDD461E",

sdk/cosmos/azure-cosmos/tests/test_feed_range_async.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from azure.cosmos import PartitionKey
1313

1414
@pytest.mark.cosmosEmulator
15-
# @pytest.mark.cosmosAAD # TEMP: disabled to validate AAD pipeline using only test_aad.py
1615
@pytest.mark.asyncio
1716
class TestFeedRangeAsync(unittest.IsolatedAsyncioTestCase):
1817
"""Tests to verify methods for operations on feed ranges
@@ -33,17 +32,13 @@ def setUpClass(cls):
3332
"tests.")
3433

3534
async def asyncSetUp(self):
36-
# Key-auth client is used for control-plane operations in this test class.
35+
# Single key-auth client is sufficient for this emulator-focused test class.
3736
self.client = CosmosClient(self.host, self.masterKey)
3837
self.database_for_test = self.client.get_database_client(self.TEST_DATABASE_ID)
39-
# AAD (or key) client for data-plane operations
40-
self.data_client = test_config.TestConfig.create_data_client_async()
41-
self.data_database_for_test = self.data_client.get_database_client(self.TEST_DATABASE_ID)
42-
self.data_container_for_test = self.data_database_for_test.get_container_client(self.TEST_CONTAINER_ID)
38+
self.container_for_test = self.database_for_test.get_container_client(self.TEST_CONTAINER_ID)
4339

4440
async def asyncTearDown(self):
4541
await self.client.close()
46-
await self.data_client.close()
4742

4843

4944
async def test_partition_key_to_feed_range_async(self):
@@ -52,8 +47,7 @@ async def test_partition_key_to_feed_range_async(self):
5247
id='container_' + str(uuid.uuid4()),
5348
partition_key=PartitionKey(path="/id")
5449
)
55-
# Data-plane proxy for feed_range operations
56-
created_container = self.data_database_for_test.get_container_client(created_container_ref.id)
50+
created_container = self.database_for_test.get_container_client(created_container_ref.id)
5751
feed_range = await created_container.feed_range_from_partition_key("1")
5852
feed_range_epk = FeedRangeInternalEpk.from_json(feed_range)
5953
assert feed_range_epk.get_normalized_range() == Range("3C80B1B7310BB39F29CC4EA05BDD461E",
@@ -65,8 +59,8 @@ async def test_feed_range_is_subset_from_pk_async(self):
6559
"FF",
6660
True,
6761
False)).to_dict()
68-
epk_child_feed_range = await self.data_container_for_test.feed_range_from_partition_key("1")
69-
assert await self.data_container_for_test.is_feed_range_subset(epk_parent_feed_range, epk_child_feed_range)
62+
epk_child_feed_range = await self.container_for_test.feed_range_from_partition_key("1")
63+
assert await self.container_for_test.is_feed_range_subset(epk_parent_feed_range, epk_child_feed_range)
7064

7165
if __name__ == '__main__':
7266
unittest.main()

0 commit comments

Comments
 (0)