Skip to content

Commit 4a53f81

Browse files
committed
minor test refactoring
1 parent 8a2368f commit 4a53f81

File tree

7 files changed

+13
-5
lines changed

7 files changed

+13
-5
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/WebJobs.Script.Tests.Integration/TestScripts/CSharp/CosmosDBTrigger/function.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"name": "input",
66
"direction": "in",
77
"databaseName": "ItemDb",
8-
"collectionName": "ItemCollection"
8+
"collectionName": "ItemCollection",
9+
"createLeaseCollectionIfNotExists": true
910
},
1011
{
1112
"type": "blob",

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/EndToEndTestsBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ protected async Task TableInputTest()
100100
protected async Task TableOutputTest()
101101
{
102102
CloudTable table = Fixture.TableClient.GetTableReference("testoutput");
103+
await table.CreateIfNotExistsAsync();
103104
await Fixture.DeleteEntities(table);
104105

105106
JObject item = new JObject

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SamplesEndToEndTests_Node.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,12 @@ await TestHelpers.Await(async () =>
385385
{
386386
request = new HttpRequestMessage(HttpMethod.Get, uri);
387387
response = await _fixture.Host.HttpClient.SendAsync(request);
388-
timestamp = response.Headers.GetValues("Shared-Module").First();
388+
389+
if (response.Headers.Contains("Shared-Module"))
390+
{
391+
timestamp = response.Headers.GetValues("Shared-Module").First();
392+
}
393+
389394
return initialTimestamp != timestamp;
390395
}, timeout: 5000, pollingInterval: 500);
391396
Assert.NotEqual(initialTimestamp, timestamp);

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SpecializationE2ETests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
using Microsoft.Azure.WebJobs.Logging.ApplicationInsights;
1818
using Microsoft.Azure.WebJobs.Script.Configuration;
1919
using Microsoft.Azure.WebJobs.Script.Description;
20-
using Microsoft.Azure.WebJobs.Script.Workers.Rpc;
2120
using Microsoft.Azure.WebJobs.Script.WebHost;
21+
using Microsoft.Azure.WebJobs.Script.Workers.Rpc;
2222
using Microsoft.Extensions.Configuration;
2323
using Microsoft.Extensions.DependencyInjection;
2424
using Microsoft.Extensions.Hosting;
@@ -175,8 +175,9 @@ public async Task Specialization_ThreadUtilization()
175175

176176
// Before the fix, when we issued the 100 requests, they would all enter the ThreadPool queue and
177177
// a new thread would be taken from the thread pool every 500ms, resulting in thread starvation.
178-
// After the fix, we should only be losing one.
179-
int precision = 1;
178+
// After the fix, we should only be losing one (but other operations may also be using a thread, so
179+
// we'll leave a little wiggle-room).
180+
int precision = 3;
180181
Assert.True(workerThreads >= originalWorkerThreads - precision, $"Available ThreadPool threads should not have decreased by more than {precision}. Actual: {workerThreads}. Original: {originalWorkerThreads}.");
181182

182183
await Task.WhenAll(requestTasks);

0 commit comments

Comments
 (0)