Skip to content

Commit

Permalink
CI - Upload logs from test-nuget-packages (#3880)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek authored Dec 11, 2024
1 parent a218aa9 commit 8c2613a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ jobs:
- name: Test NuGet Packages
run: ./build.cmd TestNuGetPackages

- name: Upload test logs
if: always()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # tag: v4.4.3
with:
name: test-logs-nuget-packages-${{ matrix.machine }}
path: test-artifacts/

test-jobs:
runs-on: ubuntu-20.04
needs:
Expand Down
15 changes: 12 additions & 3 deletions test/IntegrationTests/Helpers/EnvironmentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class EnvironmentHelper
private readonly ITestOutputHelper _output;
private readonly int _major;
private readonly int _minor;
private readonly string? _patch = null;
private readonly string? _patch;

private readonly string _appNamePrepend;
private readonly string _runtime;
Expand Down Expand Up @@ -61,6 +61,10 @@ public EnvironmentHelper(
// Only integration tests assume the default environment variable settings.
SetDefaultEnvironmentVariables();
}
else if (testApplicationType == "nuget-packages")
{
SetDefaultLogEnvironmentVariables();
}
}

public bool DebugModeEnabled { get; set; } = true;
Expand Down Expand Up @@ -270,8 +274,7 @@ private void SetDefaultEnvironmentVariables()
CustomEnvironmentVariables["COR_PROFILER"] = EnvironmentTools.ProfilerClsId;
CustomEnvironmentVariables["COR_PROFILER_PATH"] = profilerPath;

CustomEnvironmentVariables["OTEL_LOG_LEVEL"] = "debug";
CustomEnvironmentVariables["OTEL_DOTNET_AUTO_LOG_DIRECTORY"] = Path.Combine(EnvironmentTools.GetSolutionDirectory(), "test-artifacts", "profiler-logs");
SetDefaultLogEnvironmentVariables();
CustomEnvironmentVariables["OTEL_DOTNET_AUTO_HOME"] = GetNukeBuildOutput();
CustomEnvironmentVariables["OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES"] = "TestApplication.*";

Expand All @@ -280,4 +283,10 @@ private void SetDefaultEnvironmentVariables()
CustomEnvironmentVariables["OTEL_METRICS_EXPORTER"] = "none";
CustomEnvironmentVariables["OTEL_LOGS_EXPORTER"] = "none";
}

private void SetDefaultLogEnvironmentVariables()
{
CustomEnvironmentVariables["OTEL_LOG_LEVEL"] = "debug";
CustomEnvironmentVariables["OTEL_DOTNET_AUTO_LOG_DIRECTORY"] = Path.Combine(EnvironmentTools.GetSolutionDirectory(), "test-artifacts", "profiler-logs");
}
}

0 comments on commit 8c2613a

Please sign in to comment.