Skip to content

Commit 51c7ecd

Browse files
committed
Drop status text validation
1 parent 4e2bf95 commit 51c7ecd

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

src/tests/dotnet-trace/CollectCommandFunctionalTests.cs

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public sealed record CollectArgs(
5050
[MemberData(nameof(BasicCases))]
5151
public async Task CollectCommandProviderConfigurationConsolidation(CollectArgs args, string[] expectedSubset)
5252
{
53-
MockConsole console = new(200, 30) { IsOutputRedirected = false };
53+
MockConsole console = new(200, 30);
5454
string[] rawLines = await RunAsync(args, console).ConfigureAwait(true);
5555
console.AssertSanitizedLinesEqual(CollectSanitizer, expectedSubset);
5656

@@ -63,7 +63,7 @@ private static async Task<string[]> RunAsync(CollectArgs config, MockConsole con
6363
var handler = new CollectCommandHandler();
6464
handler.StartTraceSessionAsync = (client, cfg, ct) => Task.FromResult<CollectCommandHandler.ICollectSession>(new TestCollectSession());
6565
handler.ResumeRuntimeAsync = (client, ct) => Task.CompletedTask;
66-
handler.CollectSessionEventStream = (name) => new SlowSinkStream(config.EventStream);
66+
handler.CollectSessionEventStream = (name) => config.EventStream;
6767
handler.Console = console;
6868
handler.GetFileLength = (path) => Encoding.UTF8.GetByteCount(ExpectedPayload);
6969

@@ -96,32 +96,6 @@ private static async Task<string[]> RunAsync(CollectArgs config, MockConsole con
9696
return console.Lines;
9797
}
9898

99-
// As the test payload is small, we need to delay writes to the output stream to ensure
100-
// that the status update logic in CollectCommandHandler has a chance to run.
101-
private sealed class SlowSinkStream : Stream
102-
{
103-
private readonly Stream _inner;
104-
105-
public SlowSinkStream(Stream inner) { _inner = inner; }
106-
107-
public override bool CanRead => false;
108-
public override bool CanSeek => false;
109-
public override bool CanWrite => true;
110-
public override long Length => throw new NotSupportedException();
111-
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
112-
113-
public override void Flush() { }
114-
public override int Read(byte[] buffer, int offset, int count) => throw new NotSupportedException();
115-
public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();
116-
public override void SetLength(long value) => throw new NotSupportedException();
117-
public override void Write(byte[] buffer, int offset, int count) => _inner.Write(buffer, offset, count);
118-
public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
119-
{
120-
await Task.Delay(200, cancellationToken).ConfigureAwait(false);
121-
await _inner.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
122-
}
123-
}
124-
12599
private static string[] CollectSanitizer(string[] lines)
126100
{
127101
List<string> result = new();
@@ -131,10 +105,6 @@ private static string[] CollectSanitizer(string[] lines)
131105
{
132106
result.Add("Process : <PROCESS>");
133107
}
134-
else if (line.StartsWith('[') && line.Contains("Recording trace"))
135-
{
136-
result.Add("[dd:hh:mm:ss]\t" + line.Substring(14));
137-
}
138108
else
139109
{
140110
result.Add(line);
@@ -250,8 +220,7 @@ public static IEnumerable<object[]> BasicCases()
250220
private static readonly string[] CommonTail = [
251221
"Process : <PROCESS>",
252222
outputFile,
253-
"[dd:hh:mm:ss]\tRecording trace 38.00 (B)",
254-
"Press <Enter> or <Ctrl+C> to exit...",
223+
"",
255224
"\nTrace completed."
256225
];
257226

0 commit comments

Comments
 (0)