Skip to content

Commit

Permalink
Further integration test modifications
Browse files Browse the repository at this point in the history
- Don't use .Count() in polling; materialize the list to avoid duplicate RPCs
- Remove 10 minute somewhat-pointless no-exception test
  • Loading branch information
jskeet committed Feb 26, 2019
1 parent ff2fb92 commit 6b56185
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ public ErrorReportingTest()
_client = _server.CreateClient();
}

[Fact]
public async Task NoExceptions()
{
var response = await _client.GetAsync($"/ErrorReporting/{nameof(ErrorReportingController.Index)}/{_testId}");

Assert.Equal(HttpStatusCode.OK, response.StatusCode);

var errorEvents = s_polling.GetEvents(_testId, 0);
Assert.Empty(errorEvents);
}

[Fact]
public async Task ManualLog()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,16 @@ protected IEnumerable<T> GetEntries(int minEntries, Func<IEnumerable<T>> getEntr
totalSleepTime += sleepTime;
Thread.Sleep(sleepTime);

IEnumerable<T> entries = getEntries();
if (minEntries == 0 || entries.Count() >= minEntries)
List<T> entries = getEntries().ToList();
if (entries.Count >= minEntries)
{
return entries;
}
}
return new List<T>();
// We don't throw an exception here, as even if we've been asked for some entries, it may be that
// we're in a situation of expecting at least one of a few polls to succeed, and we just wanted to
// try hard to find it.
return Enumerable.Empty<T>();
}
}
}

0 comments on commit 6b56185

Please sign in to comment.