Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http trigger as valid KEDA trigger type #198

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
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