Skip to content

Commit

Permalink
Use project reference in e2e test apps
Browse files Browse the repository at this point in the history
  • Loading branch information
andystaples committed Jan 11, 2025
1 parent eea3761 commit 10d7d07
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,4 @@ functions-extensions/
/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml

# E2E Tests build output
/src/Worker.Extensions.DurableTask/out/*
/src/WebJobs.Extensions.DurableTask/out/*
7 changes: 5 additions & 2 deletions test/e2e/Apps/BasicDotNetIsolated/app.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Worker.Extensions.DurableTask\Worker.Extensions.DurableTask.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
39 changes: 18 additions & 21 deletions test/e2e/Tests/build-e2e-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ $WebJobsExtensionProjectDirectory = Join-Path $ProjectBaseDirectory "src\WebJobs
$WorkerExtensionProjectDirectory = Join-Path $ProjectBaseDirectory "src\Worker.Extensions.DurableTask"
$E2EAppProjectDirectory = Join-Path $ProjectBaseDirectory "test\e2e\Apps\BasicDotNetIsolated"

$LocalNugetCacheDirectory = $env:NUGET_PACKAGES
if (!$LocalNugetCacheDirectory) {
$LocalNugetCacheDirectory = "$env:USERPROFILE\.nuget\packages"
}

$FunctionsRuntimeVersion = 4

# A function that checks exit codes and fails script if an error is found
Expand Down Expand Up @@ -111,34 +116,26 @@ Write-Host "Moving nupkg from WebJobs extension to $E2EAppProjectDirectory/packa
Set-Location ./out
dotnet nuget push *.nupkg --source "$E2EAppProjectDirectory/packages"

Write-Host "Building worker extension project"

Set-Location $WorkerExtensionProjectDirectory
if (!(Test-Path "./out")) {
mkdir ./out -ErrorAction SilentlyContinue > $Null
}
Get-ChildItem -Path ./out -Include * -File -Recurse | ForEach-Object { $_.Delete()}
dotnet build -c Debug "$WorkerExtensionProjectDirectory\Worker.Extensions.DurableTask.csproj" --output ./out

Write-Host "Moving nupkg from worker extension to $E2EAppProjectDirectory/packages"
Set-Location ./out
dotnet nuget push *.nupkg --source "$E2EAppProjectDirectory/packages"

Write-Host "Updating app .csproj to reference built package versions"
Set-Location $E2EAppProjectDirectory
$files = Get-ChildItem -Path ./packages -Include * -File -Recurse
$files | ForEach-Object {
if ($_.Name -match 'Microsoft.Azure.Functions.Worker.Extensions.DurableTask')
{
$webJobsExtensionVersion = $_.Name -replace 'Microsoft.Azure.Functions.Worker.Extensions.DurableTask\.|\.nupkg'
Write-Host "Updating Worker.Extensions.DurableTask version to $webJobsExtensionVersion"
dotnet add app.csproj package Microsoft.Azure.Functions.Worker.Extensions.DurableTask --version $webJobsExtensionVersion
}
if ($_.Name -match 'Microsoft.Azure.WebJobs.Extensions.DurableTask')
{
$webJobsExtensionVersion = $_.Name -replace 'Microsoft.Azure.WebJobs.Extensions.DurableTask\.|\.nupkg'
Write-Host "Updating WebJobs.Extensions.DurableTask version to $webJobsExtensionVersion"
dotnet add app.csproj package Microsoft.Azure.WebJobs.Extensions.DurableTask --version $webJobsExtensionVersion

Write-Host "Removing cached version $webJobsExtensionVersion of WebJobs extension from nuget cache, if exists"
$cachedVersionFolders = Get-ChildItem -Path (Join-Path $LocalNugetCacheDirectory "microsoft.azure.webjobs.extensions.durabletask") -Directory
$cachedVersionFolders | ForEach-Object {
if ($_.Name -eq $webJobsExtensionVersion)
{
Write-Host "Removing cached version $webJobsExtensionVersion from nuget cache"
Remove-Item -Recurse -Force $_.FullName -ErrorAction Stop
}
}

# Write-Host "Updating WebJobs.Extensions.DurableTask version to $webJobsExtensionVersion"
# dotnet add app.csproj package Microsoft.Azure.WebJobs.Extensions.DurableTask --version $webJobsExtensionVersion
}
}

Expand Down
5 changes: 3 additions & 2 deletions test/e2e/Tests/e2e-tests-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ This document provides instructions on how to use the end-to-end (E2E) test proj

## Running the E2E Tests

### Step 1: Increment the host and worker package versions
### Step 1: Increment the host and worker package versions (optional)

Note: This step is optional. However, if you do not perform this step, the versions of these two packages in your local NuGet cache will be replaced with the build output from the test run, which may lead to unexpected behavior debugging live versions in other apps. Be warned.

Modify the following files:
```
\src\WebJobs.Extensions.DurableTask\WebJobs.Extensions.DurableTask.csproj
\src\Worker.Extensions.DurableTask\AssemblyInfo.cs
\src\Worker.Extensions.DurableTask\Worker.Extensions.DurableTask.csproj
```
Ensure that the versions of both the host and worker extensions are unique. Each time you make a code change in either extension, you must either bump the versions of both extensions or delete all versions of both extensions from your local NuGet cache to prevent the test app build from using old code.

### Step 2: Build the E2E Test Project

Expand Down

0 comments on commit 10d7d07

Please sign in to comment.