Make StartupTests.Ctor_LoadsManagedAssembly more accurate (#877)
* Refactor Startup * Fix Co-authored-by: Rajkumar Rangaraj <rajrang@microsoft.com>
This commit is contained in:
parent
215ab65b33
commit
07d5e80cda
|
|
@ -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.
|
||||
|
|
@ -45,8 +47,6 @@ public partial class Startup
|
|||
TryLoadManagedAssembly();
|
||||
}
|
||||
|
||||
internal static string ManagedProfilerDirectory { get; }
|
||||
|
||||
private static void TryLoadManagedAssembly()
|
||||
{
|
||||
StartupLogger.Log("Managed Loader TryLoadManagedAssembly()");
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class StartupTests
|
|||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue