From 6ba128fa4143af86268b932bebd959cc7438aecd Mon Sep 17 00:00:00 2001 From: Divya Gandhi Date: Wed, 21 Apr 2021 04:49:25 -0700 Subject: [PATCH] add http trigger as valid keda trigger type --- Kudu.Core/Functions/KedaFunctionTriggerProvider.cs | 3 +++ .../Function/KedaFunctionTriggersProviderTests.cs | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Kudu.Core/Functions/KedaFunctionTriggerProvider.cs b/Kudu.Core/Functions/KedaFunctionTriggerProvider.cs index 9f6e49b7..135f7fcc 100644 --- a/Kudu.Core/Functions/KedaFunctionTriggerProvider.cs +++ b/Kudu.Core/Functions/KedaFunctionTriggerProvider.cs @@ -191,6 +191,9 @@ internal static string GetKedaTriggerType(string triggerType) case "rabbitmqtrigger": return "rabbitmq"; + case "httptrigger": + return "httpTrigger"; + default: return string.Empty; } diff --git a/Kudu.Tests/Core/Function/KedaFunctionTriggersProviderTests.cs b/Kudu.Tests/Core/Function/KedaFunctionTriggersProviderTests.cs index bed76d9f..5d8a0d3f 100644 --- a/Kudu.Tests/Core/Function/KedaFunctionTriggersProviderTests.cs +++ b/Kudu.Tests/Core/Function/KedaFunctionTriggersProviderTests.cs @@ -23,7 +23,8 @@ public void DurableFunctionApp() CreateJsonFileEntry(archive, "f1/function.json", @"{""bindings"":[{""type"":""orchestrationTrigger"",""name"":""context""}],""disabled"":false}"); CreateJsonFileEntry(archive, "f2/function.json", @"{""bindings"":[{""type"":""entityTrigger"",""name"":""ctx""}],""disabled"":false}"); CreateJsonFileEntry(archive, "f3/function.json", @"{""bindings"":[{""type"":""activityTrigger"",""name"":""input""}],""disabled"":false}"); - CreateJsonFileEntry(archive, "f4/function.json", @"{""bindings"":[{""type"":""queueTrigger"",""connection"":""AzureWebjobsStorage"",""queueName"":""queue"",""name"":""queueItem""}],""disabled"":false}"); + CreateJsonFileEntry(archive, "f4/function.json", @"{""bindings"":[{""type"":""queueTrigger"",""connection"":""AzureWebjobsStorage"",""queueName"":""queue"",""name"":""queueItem""}],""disabled"":false}"); + CreateJsonFileEntry(archive, "f5/function.json", @"{""bindings"":[{""type"":""httpTrigger"",""methods"":[""post""],""authLevel"":""anonymous"",""name"":""req""}],""disabled"":false}"); } try @@ -44,7 +45,11 @@ public void DurableFunctionApp() ScaleTrigger queueTrigger = Assert.Single(result, trigger => trigger.Type.Equals("azure-queue", StringComparison.OrdinalIgnoreCase)); string functionName = Assert.Contains("functionName", queueTrigger.Metadata); - Assert.Equal("f4", functionName); + Assert.Equal("f4", functionName); + + ScaleTrigger httpTrigger = Assert.Single(result, trigger => trigger.Type.Equals("httpTrigger", StringComparison.OrdinalIgnoreCase)); + functionName = Assert.Contains("functionName", httpTrigger.Metadata); + Assert.Equal("f5", functionName); } finally { @@ -149,7 +154,7 @@ public void PopulateMetadataDictionary_KedaV2_OnlyKedaSupportedTriggers() { ""functionName"": ""f1"", ""bindings"": [{ - ""type"": ""httpTrigger"", + ""type"": ""eventGridTrigger"", ""methods"": [""GET""], ""authLevel"": ""anonymous"" }]