Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class AzuriteFixture : IDisposable
private AzuriteAccount account;
private CountdownEvent countdownEvent = new CountdownEvent(2);
private StringBuilder azuriteOutput = new StringBuilder();
private StringBuilder azuriteError = new StringBuilder();
private int blobsPort;
private int queuesPort;

Expand Down Expand Up @@ -79,6 +80,7 @@ public AzuriteFixture()
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
Expand All @@ -99,6 +101,16 @@ public AzuriteFixture()
}
}
};
process.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
if (!countdownEvent.IsSet) // stop error collection if it started successfully.
{
azuriteError.AppendLine(e.Data);
}
}
};
try
{
process.Start();
Expand All @@ -107,10 +119,11 @@ public AzuriteFixture()
throw new ArgumentException(ErrorMessage("could not run NodeJS, make sure it's installed"), e);
}
process.BeginOutputReadLine();
process.BeginErrorReadLine();
var didAzuriteStart = countdownEvent.Wait(TimeSpan.FromSeconds(15));
if (!didAzuriteStart)
{
throw new InvalidOperationException(ErrorMessage($"azurite process could not start with following output:\n{azuriteOutput}"));
throw new InvalidOperationException(ErrorMessage($"azurite process could not start with following output:\n{azuriteOutput}\nand error:\n{azuriteError}"));
}
account.BlobsPort = blobsPort;
account.QueuesPort = queuesPort;
Expand Down