Skip to content

Commit 0606669

Browse files
committed
test again
1 parent 8965a8b commit 0606669

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

test/WebJobs.Script.Tests.Integration/CosmosDB/CosmosDBEndToEndTestsBase.cs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Microsoft.Azure.Storage.Queue;
66
using System;
77
using System.Threading.Tasks;
8-
using System.Xml.Linq;
98
using Xunit;
109

1110
namespace Microsoft.Azure.WebJobs.Script.Tests.CosmosDB
@@ -23,10 +22,9 @@ public CosmosDBEndToEndTestsBase(TTestFixture fixture) : base(fixture)
2322
protected async Task CosmosDBTriggerToBlobTest()
2423
{
2524
// Waiting for the Processor to acquire leases
26-
await Task.Delay(5000);
25+
await Task.Delay(10000);
2726

2827
var dbName = "TriggerItemDb";
29-
await SetUpTriggerListener();
3028

3129
var resultBlob = _fixture.TestOutputContainer.GetBlockBlobReference("cosmosdbtriggere2e-completed");
3230
await resultBlob.DeleteIfExistsAsync();
@@ -44,14 +42,13 @@ await _fixture.CosmosClient.GetContainer(dbName, "ItemCollection")
4442

4543
Assert.False(string.IsNullOrEmpty(result));
4644

47-
await _fixture.DeleteCosmosDbResources(dbName);
45+
await resultBlob.DeleteIfExistsAsync();
4846
}
4947

5048
protected async Task CosmosDBTest()
5149
{
5250
var dbName = "InOutItemDb";
5351
await _fixture.CreateContainers(dbName);
54-
await SetUpTriggerListener();
5552

5653
string id = Guid.NewGuid().ToString();
5754
await _fixture.Host.BeginFunctionAsync("CosmosDBOut", id);
@@ -76,7 +73,6 @@ protected async Task CosmosDBMultipleItemsTest()
7673
{
7774
var dbName = "MultipleInOutItemDb";
7875
await _fixture.CreateContainers(dbName);
79-
await SetUpTriggerListener();
8076

8177
string id = Guid.NewGuid().ToString();
8278
await _fixture.Host.BeginFunctionAsync("CosmosDBOutMultiple", id);
@@ -133,18 +129,5 @@ await TestHelpers.Await(async () =>
133129

134130
return document;
135131
}
136-
137-
// Regardless of which function is being tested, the trigger listener needs to be set up or the test host fails
138-
private async Task SetUpTriggerListener()
139-
{
140-
var dbName = "TriggerItemDb";
141-
bool collectionsCreated = await _fixture.CreateContainers(dbName);
142-
}
143-
144-
private async Task RemoveTriggerDb()
145-
{
146-
var dbName = "TriggerItemDb";
147-
await _fixture.DeleteCosmosDbResources(dbName);
148-
}
149132
}
150133
}

test/WebJobs.Script.Tests.Integration/CosmosDB/CosmosDBEndtoEndTestFixture.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ public void InitializeCosmosClient()
6565
public override async Task InitializeAsync()
6666
{
6767
InitializeCosmosClient();
68+
await SetUpTriggerListener();
6869
await base.InitializeAsync();
6970
}
7071

7172
public override async Task DisposeAsync()
7273
{
7374
await base.DisposeAsync();
75+
await RemoveTriggerDb();
7476
CosmosClient?.Dispose();
7577
}
7678

@@ -110,5 +112,18 @@ public async Task DeleteCosmosDbResources(string dbName)
110112

111113
await database.DeleteAsync();
112114
}
115+
116+
// Regardless of which function is being tested, the trigger listener needs to be set up or the test host fails
117+
private async Task SetUpTriggerListener()
118+
{
119+
var dbName = "TriggerItemDb";
120+
bool collectionsCreated = await CreateContainers(dbName);
121+
}
122+
123+
private async Task RemoveTriggerDb()
124+
{
125+
var dbName = "TriggerItemDb";
126+
await DeleteCosmosDbResources(dbName);
127+
}
113128
}
114129
}

0 commit comments

Comments
 (0)