Skip to content

Commit

Permalink
Merge pull request #198 from divyagandhisethi/feature/k8se
Browse files Browse the repository at this point in the history
Add http trigger as valid KEDA trigger type
  • Loading branch information
pragnagopa authored Apr 21, 2021
2 parents 6facc9f + 6ba128f commit bec1505
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Kudu.Core/Functions/KedaFunctionTriggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ internal static string GetKedaTriggerType(string triggerType)
case "rabbitmqtrigger":
return "rabbitmq";

case "httptrigger":
return "httpTrigger";

default:
return string.Empty;
}
Expand Down
11 changes: 8 additions & 3 deletions Kudu.Tests/Core/Function/KedaFunctionTriggersProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
{
Expand Down Expand Up @@ -149,7 +154,7 @@ public void PopulateMetadataDictionary_KedaV2_OnlyKedaSupportedTriggers()
{
""functionName"": ""f1"",
""bindings"": [{
""type"": ""httpTrigger"",
""type"": ""eventGridTrigger"",
""methods"": [""GET""],
""authLevel"": ""anonymous""
}]
Expand Down

0 comments on commit bec1505

Please sign in to comment.