Skip to content

Commit

Permalink
Addressing some review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com>
  • Loading branch information
RyanLettieri committed Nov 4, 2023
1 parent 7b3f381 commit 2f5f3f4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/Dapr.Workflow/WorkflowLoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ public Task StartAsync(CancellationToken cancellationToken)
{
this.logger.Log(LogLevel.Information, "WorkflowLoggingService started");

this.logger.Log(LogLevel.Information, "List of registered workflows");
foreach (string item in registeredWorkflows)
{
this.logger.Log(LogLevel.Information, item);
}
this.logger.Log(LogLevel.Information, "List of registered workflows");
foreach (string item in registeredWorkflows)
{
this.logger.Log(LogLevel.Information, item);
}

this.logger.Log(LogLevel.Information, "List of registered activities:");
foreach (string item in registeredActivities)
{
this.logger.Log(LogLevel.Information, item);
}
this.logger.Log(LogLevel.Information, "List of registered activities:");
foreach (string item in registeredActivities)
{
this.logger.Log(LogLevel.Information, item);
}

return Task.CompletedTask;
}
Expand Down
1 change: 1 addition & 0 deletions test/Dapr.E2E.Test.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Program
{
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration().WriteTo.File("log.txt").CreateLogger();
CreateHostBuilder(args).Build().Run();
}

Expand Down
17 changes: 11 additions & 6 deletions test/Dapr.E2E.Test/Workflows/WorkflowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ public async Task TestWorkflowLogging()
var health = await daprClient.CheckHealthAsync();
health.Should().Be(true, "DaprClient is not healthy");

var searchTask = Task.Run(() =>
var searchTask = Task.Run(async() =>
{
using (StreamReader reader = new StreamReader(logFilePath))
{
string line;
while ((line = reader.ReadLine()) != null)
while ((line = await reader.ReadLineAsync()) != null)
{
foreach (var entry in logStrings)
{
Expand All @@ -67,12 +66,18 @@ public async Task TestWorkflowLogging()
}
}, cts.Token);

if (!Task.WaitAll(new Task[] {searchTask}, timeout))
try
{
await searchTask;
}
finally
{
File.Delete(logFilePath);
Assert.True(false, "Expected logs weren't found within timeout period");
if (!allLogsFound)
{
Assert.True(false, "The logs were not able to found within the timeout");
}
}
File.Delete(logFilePath);
}
[Fact]
public async Task TestWorkflows()
Expand Down

0 comments on commit 2f5f3f4

Please sign in to comment.