Skip to content

Commit

Permalink
junit and github actions logger dont gel well together
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Jan 30, 2024
1 parent 3880882 commit 2c35cf6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
14 changes: 11 additions & 3 deletions build/scripts/Targets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,23 @@ let private test _ =
let junitOutput = Path.Combine(testOutputPath.FullName, "junit-{assembly}-{framework}-test-results.xml")
let loggerPathArgs = $"LogFilePath=%s{junitOutput}"
let loggerArg = $"--logger:\"junit;%s{loggerPathArgs}\""
let githubActionsLogger = $"--logger:\"GitHubActions;summary.includePassedTests=true\""
let githubActionsLogger = $"--logger:\"GitHubActions;summary.includePassedTests=false\""
let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net8.0"]
//exec { run "dotnet" "test" "-c" "release" }
exec {
run "dotnet" (
["test"; "-c"; "release"; loggerArg; githubActionsLogger]
["test"; "-c"; "release"; "--no-restore"; "--no-build"; githubActionsLogger]
@ tfmArgs
@ ["--"; "RunConfiguration.CollectSourceInformation=true"]
)
}
}
(*exec {
run "dotnet" (
["test"; "-c"; "release"; "-v"; "diag"; "--no-restore"; "--no-build"; loggerArg; githubActionsLogger]
@ tfmArgs
@ ["--"; "RunConfiguration.CollectSourceInformation=true"]
)
} *)

let private validateLicenses _ =
let args = ["-u"; "-t"; "-i"; "Elastic.OpenTelemetry.sln"; "--use-project-assets-json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public async Task InitializeAsync()

public string? StorageState { get; set; }

public async Task<IPage> OpenApmLandingPage(string testName)

public async Task<IPage> NewProfiledPage(string testName)
{
var page = await Browser.NewPageAsync(new () { StorageState = StorageState });
await page.Context.Tracing.StartAsync(new()
Expand All @@ -68,6 +69,14 @@ await page.Context.Tracing.StartAsync(new()
Snapshots = true,
Sources = true
});

return page;
}


public async Task<IPage> OpenApmLandingPage(string testName)
{
var page = await NewProfiledPage(testName);
await page.GotoAsync(KibanaAppUri.ToString());
return page;
}
Expand Down
16 changes: 1 addition & 15 deletions tests/Elastic.OpenTelemetry.IntegrationTests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,7 @@ public async Task LatencyShowsAGraph()
}


public async Task InitializeAsync()
{
_testName = XunitContext.Context.UniqueTestName;
_page = await fixture.ApmUI.OpenApmLandingPage(_testName);
try
{
await fixture.ApmUI.WaitForServiceOnOverview(_page);
}
catch
{
await fixture.ApmUI.StopTrace(_page, _testName);
throw;
}

}
public async Task InitializeAsync() => _page = await fixture.ApmUI.NewProfiledPage(_testName);

public async Task DisposeAsync() => await fixture.ApmUI.StopTrace(_page, XunitContext.Context.TestException == null ? null : _testName);
}

0 comments on commit 2c35cf6

Please sign in to comment.