Skip to content

Commit

Permalink
update integration test with CategoryName (#44989)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyMothra authored Jul 15, 2024
1 parent bcb9784 commit 502cf89
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class DistroWebAppLiveTests : BaseLiveTest
{ "service.version", TestServiceVersion }
};

private const string TestLogCategoryName = "CustomCategoryName";
private const string TestLogMessage = "Message via ILogger";

// DEVELOPER TIP: Can pass RecordedTestMode.Live into the base ctor to run this test with a live resource. This is recommended for local development.
Expand All @@ -65,9 +66,10 @@ public async Task VerifyDistro()
.ConfigureResource(x => x.AddAttributes(_testResourceAttributes));

using var app = builder.Build();
app.MapGet("/", () =>
app.MapGet("/", (ILoggerFactory loggerFactory) =>
{
app.Logger.LogInformation(TestLogMessage);
var logger = loggerFactory.CreateLogger(TestLogCategoryName);
logger.LogInformation(TestLogMessage);

return "Response from Test Server";
});
Expand Down Expand Up @@ -146,9 +148,10 @@ public async Task VerifySendingToTwoResources_UsingExporter()
.ConfigureResource(x => x.AddAttributes(_testResourceAttributes));

using var app = builder.Build();
app.MapGet("/", () =>
app.MapGet("/", (ILoggerFactory loggerFactory) =>
{
app.Logger.LogInformation(TestLogMessage);
var logger = loggerFactory.CreateLogger(TestLogCategoryName);
logger.LogInformation(TestLogMessage);

return "Response from Test Server";
});
Expand Down Expand Up @@ -206,9 +209,10 @@ public async Task VerifySendingToTwoResources_UsingDistroWithExporter()
.ConfigureResource(x => x.AddAttributes(_testResourceAttributes));

using var app = builder.Build();
app.MapGet("/", () =>
app.MapGet("/", (ILoggerFactory loggerFactory) =>
{
app.Logger.LogInformation(TestLogMessage);
var logger = loggerFactory.CreateLogger(TestLogCategoryName);
logger.LogInformation(TestLogMessage);

return "Response from Test Server";
});
Expand Down Expand Up @@ -363,6 +367,10 @@ await QueryAndVerifyTrace(
ClientIP = "0.0.0.0",
Type = "AppTraces",
AppRoleInstance = TestServiceInstance,
Properties = new List<KeyValuePair<string, string>>
{
new("CategoryName", TestLogCategoryName),
}
});
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 502cf89

Please sign in to comment.