Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Cosmos] Live test fixes (#8245)
* Cosmos live test fixes

* Another test fix

* Update tests for old emulator

* Removed disabled tests
  • Loading branch information
annatisch authored Oct 29, 2019
commit aeebc9b010f6379a69853685830beee62b86e643
77 changes: 8 additions & 69 deletions sdk/cosmos/azure-cosmos/test/crud_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1908,78 +1908,17 @@ def test_create_indexing_policy_with_composite_and_spatial_indexes(self):
)
created_properties = created_container.read()
read_indexing_policy = created_properties['indexingPolicy']
self.assertListEqual(indexing_policy['spatialIndexes'], read_indexing_policy['spatialIndexes'])
self.assertListEqual(indexing_policy['compositeIndexes'], read_indexing_policy['compositeIndexes'])
db.delete_container(container=created_container)

def disabled_test_create_indexing_policy_with_composite_and_spatial_indexes_self_link(self):
self._test_create_indexing_policy_with_composite_and_spatial_indexes(False)

def disabled_test_create_indexing_policy_with_composite_and_spatial_indexes_name_based(self):
self._test_create_indexing_policy_with_composite_and_spatial_indexes(True)

def _test_create_indexing_policy_with_composite_and_spatial_indexes(self, is_name_based):
# create database
db = self.databaseForTest

indexing_policy = {
"spatialIndexes": [
{
"path": "/path0/*",
"types": [
"Point",
"LineString",
"Polygon"
]
},
{
"path": "/path1/*",
"types": [
"LineString",
"Polygon",
"MultiPolygon"
]
}
],
"compositeIndexes": [
[
{
"path": "/path1",
"order": "ascending"
},
{
"path": "/path2",
"order": "descending"
},
{
"path": "/path3",
"order": "ascending"
}
],
[
{
"path": "/path4",
"order": "ascending"
},
{
"path": "/path5",
"order": "descending"
},
{
"path": "/path6",
"order": "ascending"
}
]
]
}
if 'localhost' in self.host or '127.0.0.1' in self.host: # TODO: Differing result between live and emulator
self.assertListEqual(indexing_policy['spatialIndexes'], read_indexing_policy['spatialIndexes'])
else:
# All types are returned for spatial Indexes
indexing_policy['spatialIndexes'][0]['types'].append('MultiPolygon')
indexing_policy['spatialIndexes'][1]['types'].insert(0, 'Point')
self.assertListEqual(indexing_policy['spatialIndexes'], read_indexing_policy['spatialIndexes'])

container_id = 'composite_index_spatial_index' + str(uuid.uuid4())
container_definition = {'id': container_id, 'indexingPolicy': indexing_policy}
created_container = self.client.CreateContainer(self.GetDatabaseLink(db, is_name_based), container_definition)
read_indexing_policy = created_container['indexingPolicy']
self.assertListEqual(indexing_policy['spatialIndexes'], read_indexing_policy['spatialIndexes'])
self.assertListEqual(indexing_policy['compositeIndexes'], read_indexing_policy['compositeIndexes'])
self.client.DeleteContainer(created_container['_self'])
db.delete_container(container=created_container)

def _check_default_indexing_policy_paths(self, indexing_policy):
def __get_first(array):
Expand Down
5 changes: 1 addition & 4 deletions sdk/cosmos/azure-cosmos/test/query_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ def test_max_item_count_honored_in_order_by_query(self):
max_item_count=1,
enable_cross_partition_query=True
)
if 'localhost' in self.host or '127.0.0.1' in self.host: # TODO: Differing result between live and emulator
self.validate_query_requests_count(query_iterable, 15 * 2 + 1)
else:
self.validate_query_requests_count(query_iterable, 17 * 2 + 1)
self.validate_query_requests_count(query_iterable, 15 * 2 + 1)

query_iterable = created_collection.query_items(
query=query,
Expand Down