Skip to content

Commit

Permalink
Further version bumps and test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejgordon committed Nov 20, 2024
1 parent 7b7b6e3 commit 7672c8d
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ outputs:
major-version:
description: "The current major version number, semver"
value: ${{ steps.dotnet.outputs.major-version }}



runs:
using: "composite"
steps:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ jobs:
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap

- uses: nuget/setup-nuget@v2
with:
nuget-version: '6.x'

- uses: actions/cache@v4
with:
path: ~/.nuget/packages
Expand Down
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.61.0" />
<PackageVersion Include="Grpc.Tools" Version="2.62.0" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.0" />
<PackageVersion Include="JunitXml.TestLogger" Version="3.1.12" PrivateAssets="All" />
<PackageVersion Include="JunitXml.TestLogger" Version="4.1.0" PrivateAssets="All" />
<PackageVersion Include="MongoDB.Driver" Version="2.28.0" />
<PackageVersion Include="MongoDB.Driver.Core" Version="2.28.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
Expand Down Expand Up @@ -74,8 +74,8 @@
<PackageVersion Include="Testcontainers.RabbitMq" Version="3.10.0" />
<PackageVersion Include="Testcontainers.Redis" Version="3.10.0" />
<PackageVersion Include="YamlDotNet" Version="11.2.1" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>
<!-- Microsoft/System packages -->
<ItemGroup>
Expand Down Expand Up @@ -117,7 +117,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="Microsoft.Owin.Host.SystemWeb" Version="4.1.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageVersion Include="Microsoft.Web.Administration" Version="11.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ module Build =
/// When running on Windows and not CI, also runs MSBuild Build on .NET Framework
let Build () =
dotnet "build" Paths.Solution
if isWindows && not true then msBuild "Build" aspNetFullFramework
if isWindows && not isCI then msBuild "Build" aspNetFullFramework
copyBinRelease()

let Test (suite: TestSuite) =
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/TestEnvironment.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ namespace Scripts
open System.Runtime.InteropServices
open Fake.Core

module TestEnvironment =
let isCI = Environment.hasEnvironVar "BUILD_ID"
module TestEnvironment =
let isCI = Environment.hasEnvironVar "GITHUB_ACTIONS"
let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
let isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)

Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Apm/Helpers/LazyContextualInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal readonly struct IfNotInitedHelper
}
}

internal class LazyContextualInit
public class LazyContextualInit
{
private bool _isInited;

Expand Down
6 changes: 2 additions & 4 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<PropertyGroup>
<!-- Always generate debug symbols this allows fluent symbols exception messages to include variable names -->
<DebugSymbols>True</DebugSymbols>

<!-- Elastic.Apm.AspNetFullFramework is completely self managed since it needs a lot of special care (for now) -->
<IsRegularTestProject Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(ProjectName), '^(.*)Tests$'))">true</IsRegularTestProject>
</PropertyGroup>

<ItemGroup>
<!-- use xunit config for all test files. Allow assemblies to run in parallel -->
<Content Include="$(SolutionRoot)\xunit.runner.json" CopyToOutputDirectory="PreserveNewest" Condition="'$(IsRegularTestProject)' == 'true'" />
Expand All @@ -20,11 +20,9 @@

<ItemGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(ProjectName), '^(.*)Tests$'))">
<PackageReference Include="Microsoft.NET.Test.Sdk" />

<PackageReference Include="JunitXml.TestLogger" PrivateAssets="All" />
<PackageReference Include="GitHubActionsTestLogger" PrivateAssets="All" />
<PackageReference Include="Nullean.VsTest.Pretty.TestLogger" PrivateAssets="All" />

<PackageReference Include="FluentAssertions" />
<PackageReference Include="FluentAssertions.Analyzers" />
<PackageReference Include="xunit" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public static IEnumerable<object[]> FlushInterval_test_variants()

[Theory]
[MemberData(nameof(FlushInterval_test_variants))]
internal async void FlushInterval_test(TestArgs args, int numberOfEventsToSend)
internal async Task FlushInterval_test(TestArgs args, int numberOfEventsToSend)
{
var batchSentBarrier = new Barrier(2);
var barrierTimeout = 30.Seconds();
Expand Down
2 changes: 1 addition & 1 deletion test/Elastic.Apm.Tests/Config/ConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Elastic.Apm.Tests.Config
[Collection("UsesEnvironmentVariables")]
public class ConfigTests : IDisposable
{
public static TheoryData GlobalLabelsValidVariantsToTest => new TheoryData<string, IReadOnlyDictionary<string, string>>
public static TheoryData<string, IReadOnlyDictionary<string, string>> GlobalLabelsValidVariantsToTest => new()
{
// empty string - zero key value pairs
{ "", new Dictionary<string, string>() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Elastic.Apm.Tests.Extensions
{
public class EnumerableExtensionsTests
{
public static TheoryData EnumerablesToTest => new TheoryData<IEnumerable<object>, object[]>
public static TheoryData<IEnumerable<object>, object[]> EnumerablesToTest => new()
{
{ Array.Empty<object>(), Array.Empty<object>() },
{ Enumerable.Range(0, 0).Select(i => (object)i), Array.Empty<object>() },
Expand Down
6 changes: 3 additions & 3 deletions test/Elastic.Apm.Tests/HelpersTests/AgentSpinLockTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class AgentSpinLockTests : LoggingTestBase

public AgentSpinLockTests(ITestOutputHelper xUnitOutputHelper) : base(xUnitOutputHelper) => _logger = LoggerBase.Scoped(ThisClassName);

internal interface ISpinLockForTest
public interface ISpinLockForTest
{
void Release();

Expand All @@ -45,10 +45,10 @@ internal interface ISpinLockForTest
new NoopSpinLockForTest()
};

public static TheoryData ThreadSafeSpinLockImpls => new TheoryData<ISpinLockForTest> { new AgentSpinLockForTest() };
public static TheoryData<ISpinLockForTest> ThreadSafeSpinLockImpls => [new AgentSpinLockForTest()];

[Fact]
public void default_value_is_false()
public void DefaultValueIsFalse()
{
var sl = new AgentSpinLock();
sl.IsAcquired.Should().BeFalse();
Expand Down
2 changes: 1 addition & 1 deletion test/Elastic.Apm.Tests/HelpersTests/ExceptionUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Elastic.Apm.Tests.HelpersTests
{
public class ExceptionUtilsTests
{
public static TheoryData DoSwallowingExceptionsVariantsToTest => new TheoryData<string, Action>
public static TheoryData<string, Action> DoSwallowingExceptionsVariantsToTest => new()
{
{ ExceptionUtils.MethodExitingNormallyMsgFmt, () => { } },
{ ExceptionUtils.MethodExitingCancelledMsgFmt, () => new CancellationToken(true).ThrowIfCancellationRequested() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Elastic.Apm.Tests.HelpersTests
{
public class LazyContextualInitTests
{
public static TheoryData WaysToCallInit = new TheoryData<string, Func<LazyContextualInit, Action, bool>>
public static TheoryData<string, Func<LazyContextualInit, Action, bool>> WaysToCallInit = new()
{
{ "IfNotInited?.Init ?? false", (lazyCtxInit, initAction) => lazyCtxInit.IfNotInited?.Init(initAction) ?? false },
{ "Init", (lazyCtxInit, initAction) => lazyCtxInit.Init(initAction) }
Expand Down
2 changes: 1 addition & 1 deletion test/Elastic.Apm.Tests/HelpersTests/TimeUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class TimeUtilsTests
{
private static readonly DateTime UnixEpochDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

public static TheoryData TimestampAndDateTimeVariantsToTest => new TheoryData<long, DateTime>
public static TheoryData<long, DateTime> TimestampAndDateTimeVariantsToTest => new()
{
{ 0, UnixEpochDateTime },
{ 1, UnixEpochDateTime + TimeUtils.TimeSpanFromFractionalMilliseconds(0.001) },
Expand Down
6 changes: 3 additions & 3 deletions test/Elastic.Apm.Tests/SamplerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace Elastic.Apm.Tests
public class SamplerTests
{
// ReSharper disable once MemberCanBePrivate.Global
public static TheoryData RateVariantsToTest => new TheoryData<double>
{
public static TheoryData<double> RateVariantsToTest =>
[
0,
0.0001,
0.0123,
Expand All @@ -27,7 +27,7 @@ public class SamplerTests
0.789,
0.9999,
1
};
];

[Theory]
[MemberData(nameof(RateVariantsToTest))]
Expand Down
2 changes: 1 addition & 1 deletion test/Elastic.Apm.Tests/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SerializationTests() =>
_payloadItemSerializer = new PayloadItemSerializer();

// ReSharper disable once MemberCanBePrivate.Global
public static TheoryData SerializationUtilsTrimToPropertyMaxLengthVariantsToTest => new TheoryData<string, string>
public static TheoryData<string, string> SerializationUtilsTrimToPropertyMaxLengthVariantsToTest => new()
{
{ "", "" },
{ "A", "A" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Elastic.Apm.StartupHook.Tests
{
/// <summary>
/// A sample ASP.NET 5/Core application that can be instrumented using startup hooks
/// A sample ASP.NET Core application that can be instrumented using startup hooks
/// </summary>
public class SampleApplication : IDisposable
{
Expand Down

0 comments on commit 7672c8d

Please sign in to comment.