Skip to content

Commit

Permalink
Make StartupTests.Ctor_LoadsManagedAssembly more accurate (#877)
Browse files Browse the repository at this point in the history
* Refactor Startup

* Fix

Co-authored-by: Rajkumar Rangaraj <[email protected]>
  • Loading branch information
pellared and rajkumar-rangaraj authored Jun 23, 2022
1 parent 215ab65 commit 07d5e80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/OpenTelemetry.AutoInstrumentation.Loader/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace OpenTelemetry.AutoInstrumentation.Loader;
/// </summary>
public partial class Startup
{
private static readonly string ManagedProfilerDirectory;

/// <summary>
/// Initializes static members of the <see cref="Startup"/> class.
/// This method also attempts to load the OpenTelemetry.AutoInstrumentation .NET assembly.
Expand All @@ -45,8 +47,6 @@ static Startup()
TryLoadManagedAssembly();
}

internal static string ManagedProfilerDirectory { get; }

private static void TryLoadManagedAssembly()
{
StartupLogger.Log("Managed Loader TryLoadManagedAssembly()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Ctor_LoadsManagedAssembly()
var directory = Directory.GetCurrentDirectory();
Environment.SetEnvironmentVariable("OTEL_DOTNET_AUTO_HOME", Path.Combine(directory, "..", "Profiler"));

var exception = Record.Exception(() => AutoInstrumentation.Loader.Startup.ManagedProfilerDirectory);
var exception = Record.Exception(() => new AutoInstrumentation.Loader.Startup());

// That means the assembly was loaded successfully and Initialize method was called.
Assert.Null(exception);
Expand Down

0 comments on commit 07d5e80

Please sign in to comment.