diff --git a/src/WebJobs.Extensions.CosmosDB/Trigger/CosmosDBTriggerListener.cs b/src/WebJobs.Extensions.CosmosDB/Trigger/CosmosDBTriggerListener.cs
index 40cc12ba3..12dab1e97 100644
--- a/src/WebJobs.Extensions.CosmosDB/Trigger/CosmosDBTriggerListener.cs
+++ b/src/WebJobs.Extensions.CosmosDB/Trigger/CosmosDBTriggerListener.cs
@@ -223,7 +223,8 @@ private async Task ProcessChangesAsync(ChangeFeedProcessorContext context, IRead
{
this._healthMonitor.OnChangesDelivered(context);
FunctionResult result = await this._executor.TryExecuteAsync(new TriggeredFunctionData() { TriggerValue = docs }, cancellationToken);
- if (!result.Succeeded
+ if (result != null // TryExecuteAsync when using RetryPolicies can return null
+ && !result.Succeeded
&& result.Exception != null)
{
ChangeFeedProcessorUserException userException = new ChangeFeedProcessorUserException(result.Exception, context);
diff --git a/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj b/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj
index b17a26d01..a498cc760 100644
--- a/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj
+++ b/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj
@@ -8,7 +8,7 @@
- $(CosmosDBVersion)
+ $(CosmosDBVersion)-rc
true
@@ -19,7 +19,7 @@
-
+
diff --git a/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBEndToEndTests.cs b/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBEndToEndTests.cs
index 09824d25a..b39e9dbf9 100644
--- a/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBEndToEndTests.cs
+++ b/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBEndToEndTests.cs
@@ -59,8 +59,11 @@ public async Task CosmosDBEndToEnd()
await TestHelpers.Await(() =>
{
- return _loggerProvider.GetAllLogMessages().Count(p => p.FormattedMessage != null && p.FormattedMessage.Contains("Trigger called!")) == 4
- && _loggerProvider.GetAllLogMessages().Count(p => p.FormattedMessage != null && p.FormattedMessage.Contains("Trigger with string called!")) == 4;
+ var logMessages = _loggerProvider.GetAllLogMessages();
+ return logMessages.Count(p => p.FormattedMessage != null && p.FormattedMessage.Contains("Trigger called!")) == 4
+ && logMessages.Count(p => p.FormattedMessage != null && p.FormattedMessage.Contains("Trigger with string called!")) == 4
+ && logMessages.Count(p => p.FormattedMessage != null && p.FormattedMessage.Contains("Trigger with retry called!")) == 8
+ && logMessages.Count(p => p.Exception != null && p.Exception.InnerException.Message.Contains("Test exception") && !p.Category.StartsWith("Host.Results")) > 0;
});
// Make sure the Options were logged. Just check a few values.
@@ -72,38 +75,6 @@ await TestHelpers.Await(() =>
}
}
- [Fact]
- public async Task CosmosDBEndToEnd_WithRetry()
- {
- using (var host = await StartHostAsync(typeof(EndToEndTestClass_Retry)))
- {
- var client = await InitializeDocumentClientAsync(host.Services.GetRequiredService());
-
- // Call the outputs function directly, which will write out 3 documents
- // using with the 'input' property set to the value we provide.
- var input = Guid.NewGuid().ToString();
- var parameter = new Dictionary();
- parameter["input"] = input;
-
- await host.GetJobHost().CallAsync(nameof(EndToEndTestClass_Retry.Outputs), parameter);
-
- await TestHelpers.Await(() =>
- {
- var logMessages = _loggerProvider.GetAllLogMessages();
- foreach (LogMessage logMsg in logMessages)
- {
- if (logMsg.Exception != null)
- {
- Console.WriteLine(logMsg.Exception.InnerException.Message);
- }
- }
-
- return logMessages.Count(p => p.FormattedMessage != null && p.FormattedMessage.Contains("Trigger called!")) == 6
- && logMessages.Count(p => p.Exception != null && p.Exception.InnerException.Message.Contains("Test exception") && !p.Category.StartsWith("Host.Results")) == 1;
- });
- }
- }
-
private async Task InitializeDocumentClientAsync(IConfiguration configuration)
{
var client = new CosmosClient(configuration.GetConnectionStringOrSetting(Constants.DefaultConnectionStringName).Value);
@@ -161,6 +132,8 @@ public class QueueItem
private static class EndToEndTestClass
{
+ private static bool shouldThrow = true;
+
[NoAutomaticTrigger]
public static async Task Outputs(
string input,
@@ -203,32 +176,15 @@ public static void TriggerWithString(
log.LogInformation("Trigger with string called!");
}
}
- }
-
- private static class EndToEndTestClass_Retry
- {
- private static bool shouldThrow = true;
-
- [NoAutomaticTrigger]
- public static async Task Outputs(
- string input,
- [CosmosDB(DatabaseName, CollectionName, CreateIfNotExists = true)] IAsyncCollector