Skip to content

Commit 8599a41

Browse files
committed
re-enabling Samples e2e tests
1 parent fe0fa0e commit 8599a41

File tree

8 files changed

+213
-371
lines changed

8 files changed

+213
-371
lines changed

WebJobs.Script.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebJobs.Script.Tests.Integr
310310
EndProject
311311
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebJobs.Script.Grpc", "src\WebJobs.Script.Grpc\WebJobs.Script.Grpc.csproj", "{38920568-003E-448F-963B-41B739D1E01C}"
312312
EndProject
313+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HttpTrigger-Disabled", "HttpTrigger-Disabled", "{C7E0020B-6581-4065-A204-99302938A85C}"
314+
ProjectSection(SolutionItems) = preProject
315+
sample\HttpTrigger-Disabled\function.json = sample\HttpTrigger-Disabled\function.json
316+
sample\HttpTrigger-Disabled\index.js = sample\HttpTrigger-Disabled\index.js
317+
EndProjectSection
318+
EndProject
313319
Global
314320
GlobalSection(SharedMSBuildProjectFiles) = preSolution
315321
test\WebJobs.Script.Tests.Shared\WebJobs.Script.Tests.Shared.projitems*{35c9ccb7-d8b6-4161-bb0d-bcfa7c6dcffb}*SharedItemsImports = 13
@@ -411,6 +417,7 @@ Global
411417
{137FB7AA-B192-4766-B86A-C813D94B1995} = {AFB0F5F7-A612-4F4A-94DD-8B69CABF7970}
412418
{EDDDAED1-0E37-4ED7-A595-63F686DEE90A} = {AFB0F5F7-A612-4F4A-94DD-8B69CABF7970}
413419
{38920568-003E-448F-963B-41B739D1E01C} = {16351B76-87CA-4A8C-80A1-3DD83A0C4AA6}
420+
{C7E0020B-6581-4065-A204-99302938A85C} = {FF9C0818-30D3-437A-A62D-7A61CA44F459}
414421
EndGlobalSection
415422
GlobalSection(ExtensibilityGlobals) = postSolution
416423
SolutionGuid = {85400884-5FFD-4C27-A571-58CB3C8CAAC5}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"disabled": true,
3+
"bindings": [
4+
{
5+
"type": "httpTrigger",
6+
"name": "req",
7+
"direction": "in",
8+
"methods": [ "get" ]
9+
},
10+
{
11+
"type": "http",
12+
"name": "res",
13+
"direction": "out"
14+
}
15+
]
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = function (context, req) {
2+
context.log('Node.js HTTP trigger function invoked!');
3+
4+
context.res = {
5+
status: 200,
6+
body: 'Hello World!'
7+
};
8+
9+
context.done();
10+
}

sample/host.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@
2929
"healthCheckThreshold": 6,
3030
"counterThreshold": 0.80
3131
},
32-
"functionTimeout": "00:05:00",
33-
"functions": [ "HttpTrigger-CSharp" ]
32+
"functionTimeout": "00:05:00"
3433
}

test/WebJobs.Script.Tests.Integration/TestFunctionHost.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ public TestFunctionHost(string appRoot)
5555

5656
public ISecretManager SecretManager => _testServer.Host.Services.GetService<ISecretManager>();
5757

58+
public string LogPath => _hostSettings.LogPath;
59+
60+
public string ScriptPath => _hostSettings.ScriptPath;
61+
62+
public async Task<string> GetMasterKeyAsync()
63+
{
64+
HostSecretsInfo secrets = await SecretManager.GetHostSecretsAsync();
65+
return secrets.MasterKey;
66+
}
67+
68+
public async Task<string> GetFunctionSecretAsync(string functionName)
69+
{
70+
var secrets = await SecretManager.GetFunctionSecretsAsync(functionName);
71+
return secrets.First().Value;
72+
}
73+
5874
public HttpClient HttpClient { get; private set; }
5975

6076
public async Task StartAsync()

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/EndToEndTestFixture.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ protected EndToEndTestFixture(string rootPath, string testId)
7474

7575
public string FixtureId { get; private set; }
7676

77+
/// <summary>
78+
/// Override this to set the list of functions to write to host.json.
79+
/// </summary>
80+
/// <returns>The list of enabled functions.</returns>
7781
protected virtual IEnumerable<string> GetActiveFunctions()
7882
{
7983
return Enumerable.Empty<string>();

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SamplesEndToEndTests.cs

Lines changed: 158 additions & 368 deletions
Large diffs are not rendered by default.

test/WebJobs.Script.Tests/ScriptHostTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void ReadFunctionMetadata_Succeeds()
6969
var functionErrors = new Dictionary<string, Collection<string>>();
7070
var functionDirectories = Directory.EnumerateDirectories(config.RootScriptPath);
7171
var metadata = ScriptHost.ReadFunctionsMetadata(functionDirectories, null, functionErrors);
72-
Assert.Equal(40, metadata.Count);
72+
Assert.Equal(41, metadata.Count);
7373
}
7474

7575
[Fact]

0 commit comments

Comments
 (0)