Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup E2E test app for Net Framework #1905

Merged
merged 12 commits into from
Sep 21, 2023
8 changes: 7 additions & 1 deletion setup-e2e-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#Requires -Version 6

param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[String]
[ValidateSet("net7", "netfx")]
$DotnetVersion,

[Switch]
$SkipStorageEmulator,

Expand Down Expand Up @@ -98,7 +104,7 @@ if (Test-Path $output)
Remove-Item $output -Recurse -Force -ErrorAction Ignore
}

$AdditionalPackArgs = @("-c", "Release", "-p:FunctionsRuntimeVersion=$FunctionsRuntimeVersion")
$AdditionalPackArgs = @("-c", "Release", "-p:FunctionsRuntimeVersion=$FunctionsRuntimeVersion", "-p:DotnetVersion=$DotnetVersion")
surgupta-msft marked this conversation as resolved.
Show resolved Hide resolved

if ($SkipBuildOnPack -eq $true)
{
Expand Down
17 changes: 14 additions & 3 deletions src/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,29 @@ jobs:
{
throw "UseCoreToolsBuildFromIntegrationTests can only be set to True or False. Current value is set to $env:USECORETOOLSBUILDFROMINTEGRATIONTESTS"
}
./setup-e2e-tests.ps1 -FunctionsRuntimeVersion $env:FUNCTIONSRUNTIMEVERSION `
./setup-e2e-tests.ps1 -DotnetVersion $env:DOTNETVERSION `
-UseCoreToolsBuildFromIntegrationTests:$useIntegrationTestingCoreTools `
-SkipBuildOnPack
displayName: "Setup E2E tests"

- task: DotNetCoreCLI@2
condition: eq(variables['DotnetVersion'], 'net7')
displayName: 'Run tests'
inputs:
command: 'test'
arguments: '--no-build -c Release'
projects: |
test/**/*Tests.csproj

- task: DotNetCoreCLI@2
condition: eq(variables['DotnetVersion'], 'netfx')
displayName: 'Run tests for NetFramework'
inputs:
command: 'test'
arguments: '--no-build -c Release --filter "FullyQualifiedName~TimerTrigger"' #only run http tests to avoid emulators on Linux
surgupta-msft marked this conversation as resolved.
Show resolved Hide resolved
projects: |
test/**/*Tests.csproj

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
displayName: 'Sdk: ESRP CodeSigning - Authenticode'
condition: eq(variables.isReleaseBuild, true)
Expand Down Expand Up @@ -232,7 +242,8 @@ jobs:
name: '1ES-Hosted-AzFunc'
demands:
- ImageOverride -equals MMSUbuntu20.04TLS

condition: eq(variables['DotnetVersion'], 'net7')

steps:
- template: ../build/install-dotnet.yml
- task: DotNetCoreCLI@2
Expand All @@ -248,7 +259,7 @@ jobs:
{
throw "UseCoreToolsBuildFromIntegrationTests can only be set to True or False. Current value is set to $env:USECORETOOLSBUILDFROMINTEGRATIONTESTS"
}
./setup-e2e-tests.ps1 -FunctionsRuntimeVersion $env:FUNCTIONSRUNTIMEVERSION `
./setup-e2e-tests.ps1 -DotnetVersion $env:DOTNETVERSION `
-UseCoreToolsBuildFromIntegrationTests:$useIntegrationTestingCoreTools `
-SkipCosmosDBEmulator `
-SkipBuildOnPack
Expand Down
28 changes: 21 additions & 7 deletions test/E2ETests/E2EApps/E2EApp/E2EApp.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PropertyGroup Condition="$(DotnetVersion) != 'netfx'">
<TargetFramework>net7.0</TargetFramework>
surgupta-msft marked this conversation as resolved.
Show resolved Hide resolved
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>

<PropertyGroup>
<PropertyGroup Condition="$(DotnetVersion) == 'netfx'">
<TargetFramework>net48</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
<AssemblyName>Microsoft.Azure.Functions.Worker.E2EApp</AssemblyName>
<RootNamespace>Microsoft.Azure.Functions.Worker.E2EApp</RootNamespace>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<!-- Add only those .cs files which are expected to work with net framework -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<Compile Remove="**\*.cs"/>
<Compile Include="Timer\*.cs; Http\*.cs; *.cs"/>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Storage\src\Worker.Extensions.Storage.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Abstractions\src\Worker.Extensions.Abstractions.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.CosmosDB\src\Worker.Extensions.CosmosDB.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.EventHubs\src\Worker.Extensions.EventHubs.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Http\src\Worker.Extensions.Http.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Timer\src\Worker.Extensions.Timer.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Tables\src\Worker.Extensions.Tables.csproj" />
<ProjectReference Condition="$(TestBuild) != 'true'" Include="..\..\..\..\src\DotNetWorker\DotNetWorker.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Timer\src\Worker.Extensions.Timer.csproj" />
<ProjectReference Include="..\..\..\..\extensions\Worker.Extensions.Http\src\Worker.Extensions.Http.csproj" />
<ProjectReference Condition="$(TestBuild) != 'true'" Include="..\..\..\..\src\DotNetWorker\DotNetWorker.csproj" />
</ItemGroup>

<ItemGroup>
Expand All @@ -39,7 +53,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.14.1" />
<PackageReference Condition="$(TestBuild) == 'true'" Include="Microsoft.Azure.Functions.Worker" Version="1.18.0" />
<PackageReference Condition="$(TestBuild) == 'true'" Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
</ItemGroup>
</Project>