-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable worker indexing by default (#9574)
- Loading branch information
Showing
17 changed files
with
306 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"type": "httpTrigger", | ||
"name": "req", | ||
"direction": "in", | ||
"methods": [ "get" ] | ||
}, | ||
{ | ||
"type": "http", | ||
"name": "$return", | ||
"direction": "out" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var test = require('../Shared/test'); | ||
|
||
module.exports = function (context, req) { | ||
context.log('Node.js HTTP trigger function processed a request. Name=%s', req.query.name); | ||
|
||
var headerValue = req.headers['test-header']; | ||
if (headerValue) { | ||
context.log('test-header=' + headerValue); | ||
} | ||
|
||
var res; | ||
if (typeof req.query.name === 'undefined') { | ||
res = { | ||
status: 400, | ||
body: "Please pass a name on the query string", | ||
headers: { | ||
'Content-Type': 'text/plain' | ||
} | ||
}; | ||
} | ||
else { | ||
res = { | ||
status: 200, | ||
body: test.greeting(req.query.name), | ||
headers: { | ||
'Content-Type': 'text/plain', | ||
'Shared-Module': test.timestamp | ||
} | ||
}; | ||
} | ||
|
||
context.done(null, res); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var timestamp = new Date().getTime(); | ||
|
||
module.exports = { | ||
timestamp: timestamp, | ||
greeting: function (name) { | ||
return 'Hello ' + name; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"version": "2.0", | ||
"healthMonitor": { | ||
"enabled": true, | ||
"healthCheckInterval": "00:00:10", | ||
"healthCheckWindow": "00:02:00", | ||
"healthCheckThreshold": 6, | ||
"counterThreshold": 0.80 | ||
}, | ||
"functionTimeout": "00:00:10", | ||
"logging": { | ||
"fileLoggingMode": "always" | ||
}, | ||
"extensions": { | ||
"sendGrid": { | ||
"from": "Azure Functions <samples@functions.com>" | ||
}, | ||
"http": { | ||
"routePrefix": "api", | ||
"maxConcurrentRequests": 5, | ||
"maxOutstandingRequests": 30 | ||
}, | ||
"queues": { | ||
"visibilityTimeout": "00:00:10", | ||
"maxDequeueCount": 3 | ||
}, | ||
"eventHubs": { | ||
"maxBatchSize": 1000, | ||
"prefetchCount": 1000, | ||
"batchCheckpointFrequency": 1 | ||
}, | ||
"serviceBus": { | ||
"prefetchCount": 100, | ||
"messageHandlerOptions": { | ||
"maxConcurrentCalls": 32 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
....Tests.Integration/WebHostEndToEnd/SamplesEndToEndTests_Node_MultipleProcessesNoBundle.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.WebJobs.Script.Config; | ||
using Microsoft.Azure.WebJobs.Script.Workers.Rpc; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.WebJobs.Script.Tests; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Tests.EndToEnd | ||
{ | ||
[Trait(TestTraits.Category, TestTraits.EndToEnd)] | ||
[Trait(TestTraits.Group, TestTraits.SamplesEndToEnd)] | ||
public class SamplesEndToEndTests_Node_MultipleProcessesNoBundle : IClassFixture<SamplesEndToEndTests_Node_MultipleProcessesNoBundle.MultiplepleProcessesTestFixtureNoBundles> | ||
{ | ||
private readonly ScriptSettingsManager _settingsManager; | ||
private MultiplepleProcessesTestFixtureNoBundles _fixture; | ||
private IEnumerable<int> _nodeProcessesBeforeTestStarted; | ||
|
||
public SamplesEndToEndTests_Node_MultipleProcessesNoBundle(MultiplepleProcessesTestFixtureNoBundles fixture) | ||
{ | ||
_fixture = fixture; | ||
_nodeProcessesBeforeTestStarted = fixture.NodeProcessesBeforeTestStarted; | ||
_settingsManager = ScriptSettingsManager.Instance; | ||
} | ||
|
||
[Fact(Skip = "https://github.com/Azure/azure-functions-host/issues")] | ||
public async Task NodeProcessNoBundleConfigured_Different_AfterHostRestart() | ||
{ | ||
await SamplesTestHelpers.InvokeAndValidateHttpTrigger(_fixture, "HttpTrigger"); | ||
IEnumerable<int> nodeProcessesBeforeHostRestart = Process.GetProcessesByName("node").Select(p => p.Id); | ||
// Trigger a restart | ||
await _fixture.Host.RestartAsync(CancellationToken.None); | ||
|
||
await SamplesTestHelpers.InvokeAndValidateHttpTrigger(_fixture, "HttpTrigger"); | ||
|
||
// Wait for all the 3 process to start | ||
await Task.Delay(TimeSpan.FromMinutes(1)); | ||
|
||
IEnumerable<int> nodeProcessesAfter = Process.GetProcessesByName("node").Select(p => p.Id); | ||
|
||
// Verify node process is different after host restart | ||
var result = nodeProcessesAfter.Where(pId1 => !nodeProcessesBeforeHostRestart.Any(pId2 => pId2 == pId1) && !_fixture.NodeProcessesBeforeTestStarted.Any(pId3 => pId3 == pId1)); | ||
Assert.Equal(3, result.Count()); | ||
} | ||
|
||
public class MultiplepleProcessesTestFixtureNoBundles : EndToEndTestFixture | ||
{ | ||
private IEnumerable<int> _nodeProcessesBeforeTestStarted; | ||
|
||
public IEnumerable<int> NodeProcessesBeforeTestStarted => _nodeProcessesBeforeTestStarted; | ||
|
||
static MultiplepleProcessesTestFixtureNoBundles() | ||
{ | ||
} | ||
|
||
public MultiplepleProcessesTestFixtureNoBundles() | ||
: base(Path.Combine(Environment.CurrentDirectory, @"..", "..", "..", "..", "..", "sample", "NodeWithoutBundle"), "samples", RpcWorkerConstants.NodeLanguageWorkerName, 3) | ||
{ | ||
_nodeProcessesBeforeTestStarted = Process.GetProcessesByName("node").Select(p => p.Id); | ||
_nodeProcessesBeforeTestStarted = _nodeProcessesBeforeTestStarted ?? new List<int>(); | ||
} | ||
|
||
public override void ConfigureScriptHost(IWebJobsBuilder webJobsBuilder) | ||
{ | ||
base.ConfigureScriptHost(webJobsBuilder); | ||
webJobsBuilder.Services.Configure<ScriptJobHostOptions>(o => | ||
{ | ||
o.Functions = new[] | ||
{ | ||
"HttpTrigger" | ||
}; | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.