Skip to content

Commit c9b68da

Browse files
committed
catching and logging more exceptions in tests
1 parent 2027145 commit c9b68da

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/WebJobs.Script.Tests.Integration/Host/ScriptHostManagerTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public async Task UpdateFileAndRestart()
5151
var config = fixture.Host.ScriptConfig;
5252

5353
ExceptionDispatchInfo exception = null;
54+
ExceptionDispatchInfo updateException = null;
5455
using (var eventManager = new ScriptEventManager())
5556
using (var manager = new ScriptHostManager(config, eventManager))
5657
{
@@ -89,8 +90,9 @@ public async Task UpdateFileAndRestart()
8990
{
9091
UpdateOutputName("first", "testblob", fixture);
9192
}
92-
catch
93+
catch (Exception ex)
9394
{
95+
updateException = ExceptionDispatchInfo.Capture(ex);
9496
}
9597
}
9698

@@ -103,6 +105,7 @@ public async Task UpdateFileAndRestart()
103105
t.Join();
104106

105107
Assert.True(exception == null, exception?.SourceException?.ToString());
108+
Assert.True(updateException == null, "Failed to update output name: " + updateException?.SourceException?.ToString());
106109
}
107110
}
108111

@@ -120,6 +123,7 @@ public async Task RenameFunctionAndRestart()
120123
var blob = fixture.TestOutputContainer.GetBlockBlobReference("testblob");
121124

122125
ExceptionDispatchInfo exception = null;
126+
ExceptionDispatchInfo moveException = null;
123127
var mockEnvironment = new Mock<IScriptHostEnvironment>();
124128
using (var eventManager = new ScriptEventManager())
125129
using (var manager = new ScriptHostManager(config, eventManager, mockEnvironment.Object))
@@ -189,8 +193,9 @@ public async Task RenameFunctionAndRestart()
189193
{
190194
Directory.Move(newDirectory, oldDirectory);
191195
}
192-
catch
196+
catch (Exception ex)
193197
{
198+
moveException = ExceptionDispatchInfo.Capture(ex);
194199
}
195200
}
196201

@@ -203,6 +208,7 @@ public async Task RenameFunctionAndRestart()
203208
t.Join();
204209

205210
Assert.True(exception == null, exception?.SourceException?.ToString());
211+
Assert.True(moveException == null, "Failed to move function back to original directory: " + moveException?.SourceException?.ToString());
206212
}
207213
}
208214

0 commit comments

Comments
 (0)