Skip to content

Commit

Permalink
test: Update agent tests to test .NET 9 and remove testing on .NET 6 (#…
Browse files Browse the repository at this point in the history
…2882)

* test: Update tests for dotnet 9.

* Fixing merge errors

* Temporarily disabling ServicePointManager usage

* Setup .NET 9 in GHA

* Rerun GHA

* Trying alternate SDK format

* Trying alternate workaround for RC bug

* More test fixes

* More image updates

* Added .NET  9 as a supported version

* Messed up YML syntax

* Forcing GHA rerun

* Mark .NET 6 as (nearly) unsupported in the Agent

* Missed some "oldest"/"latest" updates

* More fixes for making .NET 8 the "oldest"

* Fixed version conflict

* A couple more version mismatches

* Missed one net6.0 tfm

* Fix integration test failures

* Fix some ContainerIntegrationTests

Note that the distro tags for Ubuntu and Debian were accidentally switched before.  "bookworm" is Debian; "jammy" was Ubuntu 22.04 but .NET 9 isn't available (yet?) on that so use "noble" (24.04) instead.

* Remove net6.0 from KafkaTestApp

* More fixes and cleanup

* Removed .NET 6 targets from Lambda tests
* AzureFunctionsApp won't work with .NET 9 yet

* Remove System.Data.SqlClient testing completely

It's not working in .NET 8 due to reflection issues, it's not supported at all in .NET 9, it's obsolete in .NET 8, bye felicia

* Update tests/Agent/IntegrationTests/ContainerIntegrationTests/Tests/MemcachedTests.cs

More generic description of memcached library version

Co-authored-by: Marty T <[email protected]>

* Update tests/Agent/IntegrationTests/ContainerIntegrationTests/Tests/MemcachedTests.cs

Same

Co-authored-by: Marty T <[email protected]>

* Update custom container image build doc

* Add back multiple version testing of Azure Functions

* Make future .NET version releases require less find-and-replace for the Lambda tests

* Remove System.Data.SqlClient from Dotty

* Temporarily disable Centos smoke test

* Fix version regression

---------

Co-authored-by: Chris Ventura <[email protected]>
Co-authored-by: chynesNR <[email protected]>
Co-authored-by: Marty T <[email protected]>
  • Loading branch information
4 people authored Nov 19, 2024
1 parent b6bdad9 commit 5a183e7
Show file tree
Hide file tree
Showing 132 changed files with 686 additions and 968 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/all_solutions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Build FullAgent.sln
run: |
Write-Host "dotnet build --force --configuration Release -p:AllowUnsafeBlocks=true ${{ env.fullagent_solution_path }}"
Expand Down Expand Up @@ -167,6 +173,12 @@ jobs:
with:
vs-prerelease: true

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: List SDKS
run: dotnet --list-sdks
shell: powershell
Expand Down Expand Up @@ -209,6 +221,12 @@ jobs:
with:
vs-prerelease: true

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Build UnboundedIntegrationTests.sln
run: |
Write-Host "List NuGet Sources"
Expand Down Expand Up @@ -374,6 +392,12 @@ jobs:
choco install azure-functions-core-tools -y --params "'/x64'"
shell: powershell

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Run Integration Tests
run: |
if ($Env:enhanced_logging -eq $True) {
Expand Down Expand Up @@ -518,6 +542,12 @@ jobs:
# Start-CosmosDbEmulator
# shell: pwsh

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Run Unbounded Integration Tests
run: |
if ($Env:enhanced_logging -eq $True) {
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
with:
languages: csharp

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Build .NET Agent Solution
run: |
dotnet build ${{ env.fullagent_solution_path }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/run_linux_container_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
INTEGRATION_TEST_SECRETS: ${{ secrets.TEST_SECRETS }}
run: |
echo $INTEGRATION_TEST_SECRETS | dotnet user-secrets set --project ${{ env.integration_tests_shared_project }}
- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Build & Run Linux Container Integration Tests
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net8.0
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net9.0
6 changes: 6 additions & 0 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'

- name: Restore NuGet Packages
run: dotnet restore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,5 @@
"ignorePatch": true,
"ignoreMinor": false,
"ignoreReason": "frequent patch releases create too much noise"
},
{
"packageName": "system.data.sqlclient"
}
]
24 changes: 24 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)\build\Versioning.targets" Condition="Exists('$(MSBuildThisFileDirectory)\build\Versioning.targets')" />
<!-- BEGIN workaround for https://github.com/dotnet/sdk/issues/43339; remove after updated to VS 17.12 or a future 17.11 patch -->
<Target Name="WorkaroundDotnetSdk43339" BeforeTargets="ResolvePackageAssets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))">
<PrimeSystemTextJson804 />
</Target>
<UsingTask
TaskName="PrimeSystemTextJson804"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
System.Reflection.Assembly.LoadFrom(@"$(MicrosoftNETBuildTasksDirectoryRoot)\..\..\..\DotnetTools\dotnet-format\BuildHost-net472\System.Text.Json.dll");
}
catch
{
// Best effort: if something moves in the SDK don't break the build.
}
]]>
</Code>
</Task>
</UsingTask>
<!-- END workaround for https://github.com/dotnet/sdk/issues/43339 -->
</Project>
2 changes: 1 addition & 1 deletion src/Agent/NewRelic/Agent/Core/AgentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void LogInitialized()
#else
if (DotnetVersion.IsUnsupportedDotnetCoreVersion(AgentInstallConfiguration.DotnetCoreVersion))
{
Log.Warn("Unsupported .NET version {0} detected. Please use net6 or net8 or newer.", AgentInstallConfiguration.DotnetCoreVersion);
Log.Warn(".NET version {0} has reached EOL, and support will be removed in the next major release of the .NET Agent. Please use net8 or newer.", AgentInstallConfiguration.DotnetCoreVersion);
}
#endif
}
Expand Down
8 changes: 7 additions & 1 deletion src/Agent/NewRelic/Agent/Core/Utilities/DotnetVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum DotnetCoreVersion
net6,
net7,
net8,
net9,
Other
}

Expand Down Expand Up @@ -102,6 +103,11 @@ public static DotnetCoreVersion GetDotnetCoreVersion()
return DotnetCoreVersion.netcoreapp31;
}

if (envVer.Major == 9)
{
return DotnetCoreVersion.net9;
}

if (envVer.Major == 8)
{
return DotnetCoreVersion.net8;
Expand Down Expand Up @@ -136,7 +142,7 @@ public static bool IsUnsupportedDotnetCoreVersion(DotnetCoreVersion version)
// Newer versions of .net will be flagged as Other until we update our version checking logic.
// So we can either check against a supported list, or an unsupported list, but the supported list
// is smaller.
var supportedDotnetCoreVersions = new List<DotnetCoreVersion> { DotnetCoreVersion.net6, DotnetCoreVersion.net8, DotnetCoreVersion.Other };
var supportedDotnetCoreVersions = new List<DotnetCoreVersion> { DotnetCoreVersion.net8, DotnetCoreVersion.net9, DotnetCoreVersion.Other };
return !supportedDotnetCoreVersions.Contains(version);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ public static IWebHost BuildWebHost(string[] args) =>
/// </summary>
private static void OverrideSslSettingsForMockNewRelic()
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public static IWebHost BuildWebHost(string[] args) =>
/// </summary>
private static void OverrideSslSettingsForMockNewRelic()
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -26,7 +26,7 @@
<None Include="local.settings.json" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" Condition="'$(TargetFramework)' == 'net9.0'"/>
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.5.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ private static async Task Main(string[] args)


var host = new HostBuilder()
// the net6 target uses the "basic" azure function configuration
// the net8 target uses the aspnetcore azure function configuration
#if NET6_0
// the net8 target uses the "basic" azure function configuration
// the net9 target uses the aspnetcore azure function configuration
#if NET8_0
.ConfigureFunctionsWorkerDefaults()
#else
#elif NET9_0
.ConfigureFunctionsWebApplication()
#endif
.Build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void ThrowException()
[HttpGet]
public async Task<ActionResult> SimulateLostTransaction()
{
#if !NET9_0_OR_GREATER
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif

using (var client = new HttpClient())
{
Expand Down Expand Up @@ -99,7 +101,9 @@ public async Task<string> HttpClient()
[HttpGet]
public async Task<string> HttpClientTaskCancelled()
{
#if !NET9_0_OR_GREATER
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ protected void Application_BeginRequest(object sender, EventArgs e)
/// </summary>
private static void OverrideSslSettingsForMockNewRelic()
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 5a183e7

Please sign in to comment.