Skip to content

Commit

Permalink
Adding more logging for gulp.msbuild and retrying for http failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hovsep Mkrtchyan committed May 25, 2016
1 parent 9f4f7d6 commit 58366bd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 21 additions & 2 deletions AutoRest/Generators/CSharp/CSharp.Tests/AcceptanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2310,8 +2310,27 @@ private static void EnsureStatusCode(HttpStatusCode expectedStatusCode, Func<Tas

private static void EnsureStatusCode<THeader>(HttpStatusCode expectedStatusCode, Func<Task<HttpOperationHeaderResponse<THeader>>> operation)
{
var response = operation().GetAwaiter().GetResult();
Assert.Equal(response.Response.StatusCode, expectedStatusCode);
// Adding retry because of flakiness of TestServer on Travis runs
HttpRequestException ex = null;
for (int i = 0; i < 3; i++)
{
HttpOperationHeaderResponse<THeader> response;
try
{
response = operation().GetAwaiter().GetResult();
}
catch(HttpRequestException x)
{
System.Threading.Thread.Sleep(10);
ex = x;
continue;
}
Assert.Equal(response.Response.StatusCode, expectedStatusCode);
return;
}
Assert.True(
false,
string.Format("EnsureStatusCode for '{0}' failed 3 times in a row. Last failure message: {1}", expectedStatusCode, ex));
}

private static void EnsureThrowsWithStatusCode(HttpStatusCode expectedStatusCode,
Expand Down
4 changes: 3 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,9 @@ gulp.task('build', function(cb) {
// warning 0219 is for unused variables, which causes the build to fail on xbuild
return gulp.src('build.proj').pipe(msbuild(mergeOptions(msbuildDefaults, {
targets: ['build'],
properties: { WarningsNotAsErrors: 0219, Configuration: 'Debug' }
properties: { WarningsNotAsErrors: 0219, Configuration: 'Debug' },
stdout: true,
errorOnFail: true
})));
});

Expand Down

0 comments on commit 58366bd

Please sign in to comment.