Skip to content

Commit a7dc36c

Browse files
liliankasemfabiocav
authored andcommitted
Fixing launch.json, IConfiguration mock behaviour and ProxyFunctionDescriptorProviderTests
1 parent 5d9eadc commit a7dc36c

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/src/WebJobs.Script.WebHost/bin/Debug/net6.0/Microsoft.Azure.WebJobs.Script.WebHost.dll",
13+
"program": "${workspaceFolder}/out/bin/WebJobs.Script.WebHost/debug_net8/Microsoft.Azure.WebJobs.Script.WebHost.dll",
1414
"args": [],
1515
"cwd": "${workspaceFolder}/sample/Node",
1616
"stopAtEntry": false,
@@ -22,7 +22,7 @@
2222
"env": {
2323
"ASPNETCORE_ENVIRONMENT": "Development",
2424
"AZURE_FUNCTIONS_ENVIRONMENT": "Development",
25-
"AzureWebJobsSecretStorageType": "Files"
25+
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
2626
},
2727
"sourceFileMap": {
2828
"/Views": "${workspaceFolder}/Views"
@@ -35,4 +35,4 @@
3535
"processId": "${command:pickProcess}"
3636
}
3737
]
38-
}
38+
}

src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
7474
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
7575
<PackageReference Include="Microsoft.Azure.AppService.Middleware.Functions" Version="1.5.4" />
76-
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.2.20220831.41" />
76+
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.3.20240307.67" />
7777
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
7878
<PackageReference Include="Microsoft.Azure.Storage.File" Version="11.1.7" />
7979

test/CSharpPrecompiledTestProjects/Dependency56/Dependency56.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

test/CSharpPrecompiledTestProjects/DependencyA/Dependency55.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

test/WebJobs.Script.Tests/Description/Proxy/ProxyFunctionDescriptorProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public async Task ValidateProxyFunctionDescriptor()
131131
var proxy = _proxyClient as ProxyClientExecutor;
132132
Assert.NotNull(proxy);
133133

134-
var proxyFunctionDescriptor = new ProxyFunctionDescriptorProvider(_scriptHost, _scriptHost.ScriptOptions, _host.Services.GetService<ICollection<IScriptBindingProvider>>(), NullLoggerFactory.Instance);
134+
var proxyFunctionDescriptor = new ProxyFunctionDescriptorProvider(_scriptHost, _scriptHost.ScriptOptions, _host.Services.GetService<IEnumerable<IScriptBindingProvider>>().ToArray(), NullLoggerFactory.Instance);
135135

136136
var (created, functionDescriptor) = await proxyFunctionDescriptor.TryCreate(_metadataCollection[0]);
137137

@@ -145,7 +145,7 @@ public async Task ValidateProxyFunctionDescriptor()
145145
[Fact]
146146
public async Task ValidateProxyFunctionInvoker()
147147
{
148-
var proxyFunctionDescriptor = new ProxyFunctionDescriptorProvider(_scriptHost, _scriptHost.ScriptOptions, _host.Services.GetService<ICollection<IScriptBindingProvider>>(), NullLoggerFactory.Instance);
148+
var proxyFunctionDescriptor = new ProxyFunctionDescriptorProvider(_scriptHost, _scriptHost.ScriptOptions, _host.Services.GetService<IEnumerable<IScriptBindingProvider>>().ToArray(), NullLoggerFactory.Instance);
149149

150150
var (created, functionDescriptor) = await proxyFunctionDescriptor.TryCreate(_metadataCollection[0]);
151151

test/WebJobs.Script.Tests/Managment/WebFunctionsManagerTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public WebFunctionsManagerTests()
7272
secretManagerMock.Setup(p => p.GetFunctionSecretsAsync("httptrigger", false)).ReturnsAsync(functionSecrets);
7373

7474
var configurationMock = new Mock<IConfiguration>(MockBehavior.Strict);
75+
configurationMock.Setup(p => p[It.IsAny<string>()]).Returns(It.IsAny<string>());
7576
configurationMock.Setup(p => p.GetReloadToken()).Returns(new Mock<IChangeToken>().Object);
7677

7778
var hostIdProviderMock = new Mock<IHostIdProvider>(MockBehavior.Strict);

test/WebJobs.Script.Tests/Workers/Rpc/RpcWorkerConfigFactoryTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ public void GetWorkerProcessCount_Tests(bool defaultWorkerConfig, bool setProces
204204
_testEnvironment.SetEnvironmentVariable(RpcWorkerConstants.FunctionsWorkerProcessCountSettingName, "7");
205205
}
206206

207+
var expectedMaxProcessCount = (setProcessCountToNumberOfCpuCores && Environment.ProcessorCount > maxProcessCount)
208+
? Environment.ProcessorCount : maxProcessCount;
209+
207210
var config = new ConfigurationBuilder().Build();
208211
var testLogger = new TestLogger("test");
209212

@@ -237,7 +240,7 @@ public void GetWorkerProcessCount_Tests(bool defaultWorkerConfig, bool setProces
237240
}
238241

239242
Assert.Equal(TimeSpan.Parse(processStartupInterval), result.ProcessStartupInterval);
240-
Assert.Equal(maxProcessCount, result.MaxProcessCount);
243+
Assert.Equal(expectedMaxProcessCount, result.MaxProcessCount);
241244
}
242245

243246
[Fact]

0 commit comments

Comments
 (0)