Skip to content

Commit

Permalink
Fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocav committed Oct 12, 2017
1 parent a63558b commit 8491f5d
Show file tree
Hide file tree
Showing 187 changed files with 327 additions and 4,025 deletions.
1 change: 1 addition & 0 deletions FailingIntegrationTests.playlist
Original file line number Diff line number Diff line change
@@ -0,0 +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>
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ test_script:
$success = $success -and $?
dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build --filter Tests.NodeEndToEndTests
dotnet test .\test\WebJobs.Script.Scaling.Tests -v q --no-build
$success = $success -and $?
$success = $success -and $?
dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build --filter "(FullyQualifiedName~Tests.NodeEndToEndTests|FullyQualifiedName~NodeContentTests|FullyQualifiedName~Tests.SecretsRepositoryTests|FullyQualifiedName~StandbyModeTests)"
dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build --filter NodeContentTests
$success = $success -and $?
# Skipping integration tests for initial build # dotnet test .\test\WebJobs.Script.Tests.Integration\ -v q --no-build
Expand Down
129 changes: 0 additions & 129 deletions src/WebJobs.Script.WebHost/FunctionRequestInvoker.cs

This file was deleted.

41 changes: 9 additions & 32 deletions src/WebJobs.Script.WebHost/ProxyFunctionExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,33 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Dependencies;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.AppService.Proxy.Client.Contract;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.WebHost;
using Microsoft.Azure.WebJobs.Script.WebHost.Controllers;
using Microsoft.Azure.WebJobs.Script.WebHost.WebHooks;

namespace Microsoft.Azure.WebJobs.Script.Host
{
public class ProxyFunctionExecutor : IFuncExecutor
{
private readonly WebScriptHostManager _scriptHostManager;
private readonly ISecretManager _secretManager;
private WebHookReceiverManager _webHookReceiverManager;
private readonly IWebJobsRouteHandler _routeHandler;

internal ProxyFunctionExecutor(WebScriptHostManager scriptHostManager, WebHookReceiverManager webHookReceiverManager, ISecretManager secretManager)
internal ProxyFunctionExecutor(WebScriptHostManager scriptHostManager, IWebJobsRouteHandler routeHandler)
{
_scriptHostManager = scriptHostManager;
_webHookReceiverManager = webHookReceiverManager;
_secretManager = secretManager;
_routeHandler = routeHandler;
}

public async Task ExecuteFuncAsync(string funcName, Dictionary<string, object> arguments, CancellationToken cancellationToken)
public async Task ExecuteFuncAsync(string functionName, Dictionary<string, object> arguments, CancellationToken cancellationToken)
{
HttpRequestMessage request = arguments[ScriptConstants.AzureFunctionsHttpRequestKey] as HttpRequestMessage;
var function = _scriptHostManager.GetHttpFunctionOrNull(request);
var request = arguments[ScriptConstants.AzureFunctionsHttpRequestKey] as HttpRequest;
var function = _scriptHostManager.Instance.Functions.FirstOrDefault(f => string.Equals(f.Name, functionName));

var functionRequestInvoker = new FunctionRequestInvoker(function, _secretManager);
var response = await functionRequestInvoker.PreprocessRequestAsync(request);

if (response != null)
{
request.Properties[ScriptConstants.AzureFunctionsHttpResponseKey] = response;
return;
}

Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> processRequestHandler = async (req, ct) =>
{
return await functionRequestInvoker.ProcessRequestAsync(req, ct, _scriptHostManager, _webHookReceiverManager);
};

var resp = await _scriptHostManager.HttpRequestManager.ProcessRequestAsync(request, processRequestHandler, cancellationToken);
request.Properties[ScriptConstants.AzureFunctionsHttpResponseKey] = resp;
return;
await _routeHandler.InvokeAsync(request.HttpContext, functionName);
}
}
}
2 changes: 1 addition & 1 deletion src/WebJobs.Script.WebHost/Routing/ScriptRouteHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
using Microsoft.AspNetCore.Authorization.Policy;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Azure.WebJobs.Script;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.WebHost.Features;
using Microsoft.Azure.WebJobs.Script.WebHost.Security.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Routing;

namespace Microsoft.Azure.WebJobs.Extensions.Http
{
Expand Down
3 changes: 1 addition & 2 deletions src/WebJobs.Script.WebHost/WebHostResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
using Microsoft.Azure.WebJobs.Script.Config;
using Microsoft.Azure.WebJobs.Script.Diagnostics;
using Microsoft.Azure.WebJobs.Script.Eventing;
using Microsoft.Extensions.Configuration;
using Microsoft.Azure.WebJobs.Script.WebHost.Properties;
using Microsoft.Azure.WebJobs.Script.WebHost.WebHooks;
using Microsoft.Extensions.Configuration;

namespace Microsoft.Azure.WebJobs.Script.WebHost
{
Expand Down
13 changes: 0 additions & 13 deletions src/WebJobs.Script.WebHost/WebScriptHostManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,6 @@ internal static void ResetStandbyMode()
_standbyMode = null;
}

// TODO: FACAVAL (WEBHOOKS SDK)
// private static MethodInfo CreateGetWebHookDataMethodInfo()
// {
// return typeof(WebHookHandlerContextExtensions).GetMethod("GetDataOrDefault", BindingFlags.Public | BindingFlags.Static);
// }

// TODO: FACAVAL (WEBHOOKS SDK)
// private static object GetWebHookData(Type dataType, WebHookHandlerContext context)
// {
// MethodInfo getDataMethod = _getWebHookDataMethod.Value.MakeGenericMethod(dataType);
// return getDataMethod.Invoke(null, new object[] { context });
// }

protected override void OnInitializeConfig(ScriptHostConfiguration config)
{
base.OnInitializeConfig(config);
Expand Down
8 changes: 0 additions & 8 deletions src/WebJobs.Script/Config/ScriptHostConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ public ScriptHostConfiguration()
/// </summary>
public LogCategoryFilter LogFilter { get; set; }

/// <summary>
/// Gets or sets the <see cref="SamplingPercentageEstimatorSettings"/> to be used for Application
/// Insights client-side sampling. If null, client-side sampling is disabled.
/// </summary>
// TODO: FACAVAL
// Need AI support to re-enable this
// public SamplingPercentageEstimatorSettings ApplicationInsightsSamplingSettings { get; set; }

/// <summary>
/// Gets or sets a test hook for modifying the configuration after host.json has been processed.
/// </summary>
Expand Down
5 changes: 2 additions & 3 deletions src/WebJobs.Script/Description/Proxies/ProxyClientExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ public ProxyData GetProxyData()

public async Task Execute(HttpRequest request, ILogger logger)
{
IFuncExecutor proxyFunctionExecutor = null;
request.Properties.TryGetValue(ScriptConstants.AzureProxyFunctionExecutorKey, out proxyFunctionExecutor);
await _proxyClient.CallAsync(new object[] { request }, proxyFunctionExecutor, logger);
request.HttpContext.Items.TryGetValue(ScriptConstants.AzureProxyFunctionExecutorKey, out object proxyFunctionExecutor);
await _proxyClient.CallAsync(new object[] { request }, proxyFunctionExecutor as IFuncExecutor, logger);
}
}
}
3 changes: 2 additions & 1 deletion test/WebJobs.Script.Scaling.Tests/ScaleUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public void WorkersToDisplayStringTests()
Assert.Contains("home-stamp:2", workerDisplayString);
}

[Theory(Skip = "Pending machine key fix"), MemberData(nameof(GetAndValidateTokenData))]
[Theory]
[MemberData(nameof(GetAndValidateTokenData))]
public void GetAndValidateTokenTests(DateTime expiredUtc, bool expected)
{
var encryptionKey = GenerateEncryptionKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<RootNamespace>Microsoft.Azure.WebJobs.Script.Scaling.Tests</RootNamespace>
<CodeAnalysisRuleSet>$(SolutionDir)\src\src.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\WebJobs.Script.Tests.Shared\TestScopedEnvironmentVariable.cs" Link="Properties\TestScopedEnvironmentVariable.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="appinsights.testlogger" Version="1.0.0" />
Expand Down
Loading

0 comments on commit 8491f5d

Please sign in to comment.