Skip to content

Commit 8491f5d

Browse files
committed
Fixes after rebase
1 parent a63558b commit 8491f5d

File tree

187 files changed

+327
-4025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+327
-4025
lines changed

FailingIntegrationTests.playlist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Playlist Version="1.0"><Add Test="Microsoft.Azure.WebJobs.Script.Tests.CSharpEndToEndTests.FileLogging_Succeeds" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.FSharpEndToEndTests.Scenario_RandGuidBinding_GeneratesRandomIDs" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.FSharpEndToEndTests.QueueTriggerToBlob" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.DirectLoadEndToEndTests.Invoke" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.BashEndToEndTests.BlobTriggerToBlobTest" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.CSharpEndToEndTests.HttpTrigger_GetWithAccept_NegotiatesContent" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.EndToEndTimeoutTests.TimeoutTest_SyncFunction_Batch" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.FSharpEndToEndTests.SharedAssemblyDependenciesAreLoaded" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsNodeEndToEndTests.Validate_Http_Success" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WindowsBatchEndToEndTests.ManualTrigger_Invoke_Succeeds" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsNodeEndToEndTests.Validate_Http_Failure" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WindowsBatchEndToEndTests.WebHookTrigger_GenericJson" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsNodeEndToEndTests.Validate_Http_Throw" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WebScriptHostManagerTests.EmptyHost_StartsSuccessfully" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WebScriptHostManagerTests.MultipleHostRestarts" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.Host.WebScriptHostManagerTimeoutTests.OnTimeoutException_UsesToken_ManagerKeepsRunning" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.RawAssemblyEndToEndTests.Invoking_DotNetFunctionShared" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.RawAssemblyEndToEndTests.Invoking_DotNetFunction" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.PythonEndToEndTests.QueueTriggerToBlob" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WindowsBatchEndToEndTests.HttpTrigger_Get" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.FSharpEndToEndTests.FileLogging_Succeeds" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.CSharpEndToEndTests.HttpTriggerToBlob" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.FSharpEndToEndTests.PrivateAssemblyDependenciesAreLoaded" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsNodeEndToEndTests.Validate_HostLogs" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ScriptHostManagerTests.RunAndBlock_DisposesOfHost_WhenExceptionIsThrown" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.FSharpEndToEndTests.ScriptReference_LoadsScript" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.EndToEndTimeoutTests.TimeoutTest_SyncFunction_Node" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsCSharpEndToEndTests.Validate_Http_Throw" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ListenerFailureTests.ListenerError_LogsAndDoesNotStopHost" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WindowsBatchEndToEndTests.HttpTrigger_Post_String" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.PythonEndToEndTests.ManualTrigger_Invoke_Succeeds" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.EndToEndTimeoutTests.TimeoutTest_SyncFunction_Python" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WebScriptHostManagerTests.SecretFilesArePurgedOnStartup" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.RawAssemblyEndToEndTests.AssemblyChange_TriggersEnvironmentShutdown" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WebScriptHostManagerTests.FunctionInvoke_SystemTraceEventsAreEmitted" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsCSharpEndToEndTests.Validate_HostLogs" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WebScriptHostManagerTests.FunctionLogFilesArePurgedOnStartup" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.EndToEndTimeoutTests.TimeoutTest_SyncFunction_Powershell" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.Host.WebScriptHostManagerTimeoutTests.OnTimeoutException_IgnoreToken_StopsManager" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsNodeEndToEndTests.Validate_Manual" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsCSharpEndToEndTests.Validate_Http_Success" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.CSharpEndToEndTests.TwilioReferenceInvokeSucceeds" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.RawAssemblyEndToEndTests.Invoke_WithSameTypeNames_InvokesExpectedMethod" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsCSharpEndToEndTests.Validate_Manual" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.StandbyManagerTests.StandbyMode_EndToEnd" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.WindowsBatchEndToEndTests.QueueTriggerToBlob" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.ApplicationInsights.ApplicationInsightsCSharpEndToEndTests.Validate_Http_Failure" /><Add Test="Microsoft.Azure.WebJobs.Script.Tests.EndToEndTimeoutTests.TimeoutTest_SyncFunction_Bash" /></Playlist>

appveyor.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ test_script:
4343
4444
$success = $success -and $?
4545
46-
dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build --filter Tests.NodeEndToEndTests
46+
dotnet test .\test\WebJobs.Script.Scaling.Tests -v q --no-build
4747
48-
$success = $success -and $?
48+
$success = $success -and $?
49+
50+
dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build --filter "(FullyQualifiedName~Tests.NodeEndToEndTests|FullyQualifiedName~NodeContentTests|FullyQualifiedName~Tests.SecretsRepositoryTests|FullyQualifiedName~StandbyModeTests)"
4951
50-
dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build --filter NodeContentTests
51-
5252
$success = $success -and $?
5353
5454
# Skipping integration tests for initial build # dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build

src/WebJobs.Script.WebHost/FunctionRequestInvoker.cs

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/WebJobs.Script.WebHost/ProxyFunctionExecutor.cs

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,33 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.IO;
7-
using System.Net;
8-
using System.Net.Http;
6+
using System.Linq;
97
using System.Threading;
108
using System.Threading.Tasks;
11-
using System.Web.Http.Dependencies;
9+
using Microsoft.AspNetCore.Http;
1210
using Microsoft.Azure.AppService.Proxy.Client.Contract;
1311
using Microsoft.Azure.WebJobs.Extensions.Http;
14-
using Microsoft.Azure.WebJobs.Script.Description;
1512
using Microsoft.Azure.WebJobs.Script.WebHost;
16-
using Microsoft.Azure.WebJobs.Script.WebHost.Controllers;
17-
using Microsoft.Azure.WebJobs.Script.WebHost.WebHooks;
1813

1914
namespace Microsoft.Azure.WebJobs.Script.Host
2015
{
2116
public class ProxyFunctionExecutor : IFuncExecutor
2217
{
2318
private readonly WebScriptHostManager _scriptHostManager;
24-
private readonly ISecretManager _secretManager;
25-
private WebHookReceiverManager _webHookReceiverManager;
19+
private readonly IWebJobsRouteHandler _routeHandler;
2620

27-
internal ProxyFunctionExecutor(WebScriptHostManager scriptHostManager, WebHookReceiverManager webHookReceiverManager, ISecretManager secretManager)
21+
internal ProxyFunctionExecutor(WebScriptHostManager scriptHostManager, IWebJobsRouteHandler routeHandler)
2822
{
2923
_scriptHostManager = scriptHostManager;
30-
_webHookReceiverManager = webHookReceiverManager;
31-
_secretManager = secretManager;
24+
_routeHandler = routeHandler;
3225
}
3326

34-
public async Task ExecuteFuncAsync(string funcName, Dictionary<string, object> arguments, CancellationToken cancellationToken)
27+
public async Task ExecuteFuncAsync(string functionName, Dictionary<string, object> arguments, CancellationToken cancellationToken)
3528
{
36-
HttpRequestMessage request = arguments[ScriptConstants.AzureFunctionsHttpRequestKey] as HttpRequestMessage;
37-
var function = _scriptHostManager.GetHttpFunctionOrNull(request);
29+
var request = arguments[ScriptConstants.AzureFunctionsHttpRequestKey] as HttpRequest;
30+
var function = _scriptHostManager.Instance.Functions.FirstOrDefault(f => string.Equals(f.Name, functionName));
3831

39-
var functionRequestInvoker = new FunctionRequestInvoker(function, _secretManager);
40-
var response = await functionRequestInvoker.PreprocessRequestAsync(request);
41-
42-
if (response != null)
43-
{
44-
request.Properties[ScriptConstants.AzureFunctionsHttpResponseKey] = response;
45-
return;
46-
}
47-
48-
Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> processRequestHandler = async (req, ct) =>
49-
{
50-
return await functionRequestInvoker.ProcessRequestAsync(req, ct, _scriptHostManager, _webHookReceiverManager);
51-
};
52-
53-
var resp = await _scriptHostManager.HttpRequestManager.ProcessRequestAsync(request, processRequestHandler, cancellationToken);
54-
request.Properties[ScriptConstants.AzureFunctionsHttpResponseKey] = resp;
55-
return;
32+
await _routeHandler.InvokeAsync(request.HttpContext, functionName);
5633
}
5734
}
5835
}

src/WebJobs.Script.WebHost/Routing/ScriptRouteHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
using Microsoft.AspNetCore.Authorization.Policy;
1111
using Microsoft.AspNetCore.Http;
1212
using Microsoft.AspNetCore.Mvc;
13+
using Microsoft.AspNetCore.Routing;
1314
using Microsoft.Azure.WebJobs.Logging;
1415
using Microsoft.Azure.WebJobs.Script;
1516
using Microsoft.Azure.WebJobs.Script.Description;
1617
using Microsoft.Azure.WebJobs.Script.WebHost.Features;
1718
using Microsoft.Azure.WebJobs.Script.WebHost.Security.Authorization;
1819
using Microsoft.Extensions.DependencyInjection;
1920
using Microsoft.Extensions.Logging;
20-
using Microsoft.AspNetCore.Routing;
2121

2222
namespace Microsoft.Azure.WebJobs.Extensions.Http
2323
{

src/WebJobs.Script.WebHost/WebHostResolver.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
using Microsoft.Azure.WebJobs.Script.Config;
1010
using Microsoft.Azure.WebJobs.Script.Diagnostics;
1111
using Microsoft.Azure.WebJobs.Script.Eventing;
12-
using Microsoft.Extensions.Configuration;
1312
using Microsoft.Azure.WebJobs.Script.WebHost.Properties;
14-
using Microsoft.Azure.WebJobs.Script.WebHost.WebHooks;
13+
using Microsoft.Extensions.Configuration;
1514

1615
namespace Microsoft.Azure.WebJobs.Script.WebHost
1716
{

src/WebJobs.Script.WebHost/WebScriptHostManager.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,6 @@ internal static void ResetStandbyMode()
175175
_standbyMode = null;
176176
}
177177

178-
// TODO: FACAVAL (WEBHOOKS SDK)
179-
// private static MethodInfo CreateGetWebHookDataMethodInfo()
180-
// {
181-
// return typeof(WebHookHandlerContextExtensions).GetMethod("GetDataOrDefault", BindingFlags.Public | BindingFlags.Static);
182-
// }
183-
184-
// TODO: FACAVAL (WEBHOOKS SDK)
185-
// private static object GetWebHookData(Type dataType, WebHookHandlerContext context)
186-
// {
187-
// MethodInfo getDataMethod = _getWebHookDataMethod.Value.MakeGenericMethod(dataType);
188-
// return getDataMethod.Invoke(null, new object[] { context });
189-
// }
190-
191178
protected override void OnInitializeConfig(ScriptHostConfiguration config)
192179
{
193180
base.OnInitializeConfig(config);

src/WebJobs.Script/Config/ScriptHostConfiguration.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@ public ScriptHostConfiguration()
9999
/// </summary>
100100
public LogCategoryFilter LogFilter { get; set; }
101101

102-
/// <summary>
103-
/// Gets or sets the <see cref="SamplingPercentageEstimatorSettings"/> to be used for Application
104-
/// Insights client-side sampling. If null, client-side sampling is disabled.
105-
/// </summary>
106-
// TODO: FACAVAL
107-
// Need AI support to re-enable this
108-
// public SamplingPercentageEstimatorSettings ApplicationInsightsSamplingSettings { get; set; }
109-
110102
/// <summary>
111103
/// Gets or sets a test hook for modifying the configuration after host.json has been processed.
112104
/// </summary>

src/WebJobs.Script/Description/Proxies/ProxyClientExecutor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ public ProxyData GetProxyData()
2525

2626
public async Task Execute(HttpRequest request, ILogger logger)
2727
{
28-
IFuncExecutor proxyFunctionExecutor = null;
29-
request.Properties.TryGetValue(ScriptConstants.AzureProxyFunctionExecutorKey, out proxyFunctionExecutor);
30-
await _proxyClient.CallAsync(new object[] { request }, proxyFunctionExecutor, logger);
28+
request.HttpContext.Items.TryGetValue(ScriptConstants.AzureProxyFunctionExecutorKey, out object proxyFunctionExecutor);
29+
await _proxyClient.CallAsync(new object[] { request }, proxyFunctionExecutor as IFuncExecutor, logger);
3130
}
3231
}
3332
}

test/WebJobs.Script.Scaling.Tests/ScaleUtilsTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public void WorkersToDisplayStringTests()
114114
Assert.Contains("home-stamp:2", workerDisplayString);
115115
}
116116

117-
[Theory(Skip = "Pending machine key fix"), MemberData(nameof(GetAndValidateTokenData))]
117+
[Theory]
118+
[MemberData(nameof(GetAndValidateTokenData))]
118119
public void GetAndValidateTokenTests(DateTime expiredUtc, bool expected)
119120
{
120121
var encryptionKey = GenerateEncryptionKey();

0 commit comments

Comments
 (0)