Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b2cb0a5
Added Cross partition query tests for sync and async APIs
kushagraThapar Dec 1, 2023
a3fcabb
Added license header for new files
kushagraThapar Dec 1, 2023
bc81ab2
Updated database and container creation
kushagraThapar Dec 4, 2023
187b3d2
Updated python tests with setup and tear down
kushagraThapar Dec 8, 2023
f589e48
Fixed some tests cases
kushagraThapar Dec 8, 2023
40cf21e
Fixed spelling
kushagraThapar Dec 8, 2023
998b997
Added emulator CI
kushagraThapar Dec 12, 2023
f7d9ca4
Merged latest main and resolved conflicts
kushagraThapar Jan 12, 2024
cbaf26e
Removed python 3.7 emulator tests config
kushagraThapar Jan 12, 2024
d1434ae
Removed collection crud tests from emulator
kushagraThapar Jan 17, 2024
ade8a78
Merged latest main and resolved conflicts
kushagraThapar Jan 17, 2024
c7ccc22
Updated some collection heavy tests to skip for emulator
kushagraThapar Jan 17, 2024
cafc996
Fixing python 3.10
kushagraThapar Jan 18, 2024
b763f8b
Marking test_computed_properties async test to run only in live tests
kushagraThapar Jan 22, 2024
d95157a
Merge branch 'main' into azure_cosmos_add_cross_partition_query_tests
kushagraThapar Jan 22, 2024
7a34c7e
Fixed emulator tests with pytest fixtures
kushagraThapar Jan 29, 2024
c05e65c
Fixed more emulator tests with pytest fixtures
kushagraThapar Jan 30, 2024
6252619
Fixed more emulator tests with pytest fixtures
kushagraThapar Jan 31, 2024
420d639
Fixed more emulator tests with pytest fixtures and updated azure core…
kushagraThapar Feb 1, 2024
acbb98a
Fixed flaky tests
kushagraThapar Feb 1, 2024
a64f69c
Updated stored procedure create calls
kushagraThapar Feb 1, 2024
06d708c
Fixing sproc test
kushagraThapar Feb 2, 2024
1b85744
Fixing trigger test
kushagraThapar Feb 2, 2024
9b93a8f
Fixing flaky live ci tests
kushagraThapar Feb 5, 2024
499ef27
Fixing max parallel and removed python 3.11 for cosmos emulator windo…
kushagraThapar Feb 5, 2024
8198961
Added MIT license header
kushagraThapar Feb 7, 2024
b51d6f6
Update sdk/cosmos/azure-cosmos/test/test_partition_split_query.py
simorenoh Feb 7, 2024
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
Updated stored procedure create calls
  • Loading branch information
kushagraThapar committed Feb 1, 2024
commit a64f69ce328db606bf9de9deaaac2804ba8755ba
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"""Tests for the CosmosHttpLoggingPolicy."""
import logging
import unittest
import uuid

import pytest

Expand Down Expand Up @@ -87,7 +88,8 @@ def setUpClass(cls):

def test_default_http_logging_policy(self):
# Test if we can log into from creating a database
self.client_default.create_database(id="database_test")
database_id = "database_test-" + str(uuid.uuid4())
self.client_default.create_database(id=database_id)
assert all(m.levelname == 'INFO' for m in self.mock_handler_default.messages)
messages_request = self.mock_handler_default.messages[0].message.split("\n")
messages_response = self.mock_handler_default.messages[1].message.split("\n")
Expand All @@ -100,11 +102,12 @@ def test_default_http_logging_policy(self):
self.mock_handler_default.reset()

# delete database
self.client_default.delete_database("database_test")
self.client_default.delete_database(database_id)

def test_cosmos_http_logging_policy(self):
# Test if we can log into from creating a database
self.client_diagnostic.create_database(id="database_test")
database_id = "database_test-" + str(uuid.uuid4())
self.client_diagnostic.create_database(id=database_id)
assert all(m.levelname == 'INFO' for m in self.mock_handler_diagnostic.messages)
messages_request = self.mock_handler_diagnostic.messages[3].message.split("\n")
messages_response = self.mock_handler_diagnostic.messages[4].message.split("\n")
Expand All @@ -120,7 +123,7 @@ def test_cosmos_http_logging_policy(self):
self.mock_handler_diagnostic.reset()
# now test in case of an error
try:
self.client_diagnostic.create_database(id="database_test")
self.client_diagnostic.create_database(id=database_id)
except:
pass
assert all(m.levelname == 'INFO' for m in self.mock_handler_diagnostic.messages)
Expand All @@ -136,7 +139,7 @@ def test_cosmos_http_logging_policy(self):
assert "Response headers" in messages_response[1]

# delete database
self.client_diagnostic.delete_database("database_test")
self.client_diagnostic.delete_database(database_id)

self.mock_handler_diagnostic.reset()

Expand Down
12 changes: 6 additions & 6 deletions sdk/cosmos/azure-cosmos/test/test_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def test_partitioned_collection_execute_stored_procedure(self):
' });}')
}

created_sproc = created_collection.scripts.create_stored_procedure(body=sproc)
created_sproc = created_collection.scripts.create_stored_procedure(sproc)

# Partiton Key value same as what is specified in the stored procedure body
result = created_collection.scripts.execute_stored_procedure(sproc=created_sproc['id'], partition_key=2)
Expand Down Expand Up @@ -1511,7 +1511,7 @@ def test_sproc_crud(self):
'id': 'sample sproc',
'serverScript': 'function() {var x = 10;}'
}
sproc = collection.scripts.create_stored_procedure(body=sproc_definition)
sproc = collection.scripts.create_stored_procedure(sproc_definition)
for property in sproc_definition:
if property != "serverScript":
self.assertEqual(
Expand Down Expand Up @@ -1577,7 +1577,7 @@ def test_script_logging_execute_stored_procedure(self):
'}')
}

created_sproc = created_collection.scripts.create_stored_procedure(body=sproc)
created_sproc = created_collection.scripts.create_stored_procedure(sproc)

result = created_collection.scripts.execute_stored_procedure(
sproc=created_sproc['id'],
Expand Down Expand Up @@ -2147,7 +2147,7 @@ def test_stored_procedure_functionality(self):
'}')
}

retrieved_sproc = collection.scripts.create_stored_procedure(body=sproc1)
retrieved_sproc = collection.scripts.create_stored_procedure(sproc1)
result = collection.scripts.execute_stored_procedure(
sproc=retrieved_sproc['id'],
partition_key=1
Expand All @@ -2163,7 +2163,7 @@ def test_stored_procedure_functionality(self):
' }' +
'}')
}
retrieved_sproc2 = collection.scripts.create_stored_procedure(body=sproc2)
retrieved_sproc2 = collection.scripts.create_stored_procedure(sproc2)
result = collection.scripts.execute_stored_procedure(
sproc=retrieved_sproc2['id'],
partition_key=1
Expand All @@ -2178,7 +2178,7 @@ def test_stored_procedure_functionality(self):
' \'a\' + input.temp);' +
'}')
}
retrieved_sproc3 = collection.scripts.create_stored_procedure(body=sproc3)
retrieved_sproc3 = collection.scripts.create_stored_procedure(sproc3)
result = collection.scripts.execute_stored_procedure(
sproc=retrieved_sproc3['id'],
params={'temp': 'so'},
Expand Down