@@ -18,17 +18,15 @@ namespace Microsoft.Azure.Documents.ChangeFeedProcessor.IntegrationTests
18
18
[ Collection ( "Integration tests" ) ]
19
19
public class EstimatorTests : IntegrationTest
20
20
{
21
- public EstimatorTests ( IntegrationTestFixture fixture ) : base ( fixture , typeof ( EstimatorTests ) , false )
21
+ public EstimatorTests ( ) : base ( false )
22
22
{
23
23
}
24
24
25
25
[ Fact ]
26
26
public async Task CountPendingDocuments ( )
27
27
{
28
- // Cleanup the test collection to avoid other tests' documents causing issues with StartFromBeginning
29
- await this . ResetTestCollection ( ) ;
30
28
int documentCount = 1 ;
31
- int partitionCount = await IntegrationTestsHelper . GetPartitionCount ( this . ClassData . monitoredCollectionInfo ) ;
29
+ int partitionCount = await IntegrationTestsHelper . GetPartitionCount ( this . MonitoredCollectionInfo ) ;
32
30
int openedCount = 0 , processedCount = 0 ;
33
31
var allObserversStarted = new ManualResetEvent ( false ) ;
34
32
var allDocsProcessed = new ManualResetEvent ( false ) ;
@@ -52,7 +50,7 @@ public async Task CountPendingDocuments()
52
50
53
51
var host = new ChangeFeedEventHost (
54
52
hostName ,
55
- this . ClassData . monitoredCollectionInfo ,
53
+ this . MonitoredCollectionInfo ,
56
54
this . LeaseCollectionInfo ,
57
55
new ChangeFeedOptions { StartFromBeginning = false } ,
58
56
new ChangeFeedHostOptions ( ) ) ;
@@ -64,11 +62,11 @@ public async Task CountPendingDocuments()
64
62
long estimation = await host . GetEstimatedRemainingWork ( ) ;
65
63
Assert . Equal ( 0 , estimation ) ;
66
64
67
- using ( var client = new DocumentClient ( this . ClassData . monitoredCollectionInfo . Uri , this . ClassData . monitoredCollectionInfo . MasterKey , this . ClassData . monitoredCollectionInfo . ConnectionPolicy ) )
65
+ using ( var client = new DocumentClient ( this . MonitoredCollectionInfo . Uri , this . MonitoredCollectionInfo . MasterKey , this . MonitoredCollectionInfo . ConnectionPolicy ) )
68
66
{
69
67
await IntegrationTestsHelper . CreateDocumentsAsync (
70
68
client ,
71
- UriFactory . CreateDocumentCollectionUri ( this . ClassData . monitoredCollectionInfo . DatabaseName , this . ClassData . monitoredCollectionInfo . CollectionName ) ,
69
+ UriFactory . CreateDocumentCollectionUri ( this . MonitoredCollectionInfo . DatabaseName , this . MonitoredCollectionInfo . CollectionName ) ,
72
70
1 ) ;
73
71
74
72
var isStartOk = allObserversStarted . WaitOne ( IntegrationTest . changeWaitTimeout + IntegrationTest . changeWaitTimeout ) ;
@@ -84,15 +82,15 @@ await IntegrationTestsHelper.CreateDocumentsAsync(
84
82
85
83
await IntegrationTestsHelper . CreateDocumentsAsync (
86
84
client ,
87
- UriFactory . CreateDocumentCollectionUri ( this . ClassData . monitoredCollectionInfo . DatabaseName , this . ClassData . monitoredCollectionInfo . CollectionName ) ,
85
+ UriFactory . CreateDocumentCollectionUri ( this . MonitoredCollectionInfo . DatabaseName , this . MonitoredCollectionInfo . CollectionName ) ,
88
86
1 ) ;
89
87
90
88
estimation = await host . GetEstimatedRemainingWork ( ) ;
91
89
Assert . Equal ( 1 , estimation ) ;
92
90
93
91
await IntegrationTestsHelper . CreateDocumentsAsync (
94
92
client ,
95
- UriFactory . CreateDocumentCollectionUri ( this . ClassData . monitoredCollectionInfo . DatabaseName , this . ClassData . monitoredCollectionInfo . CollectionName ) ,
93
+ UriFactory . CreateDocumentCollectionUri ( this . MonitoredCollectionInfo . DatabaseName , this . MonitoredCollectionInfo . CollectionName ) ,
96
94
10 ) ;
97
95
98
96
estimation = await host . GetEstimatedRemainingWork ( ) ;
@@ -101,7 +99,7 @@ await IntegrationTestsHelper.CreateDocumentsAsync(
101
99
// Create a new host to process pending changes
102
100
var newHost = new ChangeFeedEventHost (
103
101
hostName ,
104
- this . ClassData . monitoredCollectionInfo ,
102
+ this . MonitoredCollectionInfo ,
105
103
this . LeaseCollectionInfo ,
106
104
new ChangeFeedOptions { StartFromBeginning = false } ,
107
105
new ChangeFeedHostOptions ( ) ) ;
@@ -132,13 +130,11 @@ await IntegrationTestsHelper.CreateDocumentsAsync(
132
130
[ Fact ]
133
131
public async Task WhenNoLeasesExistReturn1 ( )
134
132
{
135
- // Cleanup the test collection to avoid other tests' documents causing issues with StartFromBeginning
136
- await this . ResetTestCollection ( ) ;
137
133
var hostName = Guid . NewGuid ( ) . ToString ( ) ;
138
134
139
135
var host = new ChangeFeedEventHost (
140
136
hostName ,
141
- this . ClassData . monitoredCollectionInfo ,
137
+ this . MonitoredCollectionInfo ,
142
138
this . LeaseCollectionInfo ,
143
139
new ChangeFeedOptions { StartFromBeginning = false } ,
144
140
new ChangeFeedHostOptions ( ) ) ;
@@ -155,10 +151,8 @@ public async Task WhenNoLeasesExistReturn1()
155
151
[ Fact ]
156
152
public async Task WhenLeasesHaveContinuationTokenNullReturn0 ( )
157
153
{
158
- // Cleanup the test collection to avoid other tests' documents causing issues with StartFromBeginning
159
- await this . ResetTestCollection ( ) ;
160
154
int documentCount = 1 ;
161
- int partitionCount = await IntegrationTestsHelper . GetPartitionCount ( this . ClassData . monitoredCollectionInfo ) ;
155
+ int partitionCount = await IntegrationTestsHelper . GetPartitionCount ( this . MonitoredCollectionInfo ) ;
162
156
int openedCount = 0 , processedCount = 0 ;
163
157
var allObserversStarted = new ManualResetEvent ( false ) ;
164
158
var allDocsProcessed = new ManualResetEvent ( false ) ;
@@ -183,7 +177,7 @@ public async Task WhenLeasesHaveContinuationTokenNullReturn0()
183
177
// We create a host to initialize the leases with ContinuationToken null
184
178
var host = new ChangeFeedEventHost (
185
179
hostName ,
186
- this . ClassData . monitoredCollectionInfo ,
180
+ this . MonitoredCollectionInfo ,
187
181
this . LeaseCollectionInfo ,
188
182
new ChangeFeedOptions { StartFromBeginning = false } ,
189
183
new ChangeFeedHostOptions ( ) ) ;
@@ -205,10 +199,8 @@ public async Task WhenLeasesHaveContinuationTokenNullReturn0()
205
199
[ Fact ]
206
200
public async Task WhenLeasesHaveContinuationTokenNullStartFromBeginning ( )
207
201
{
208
- // Cleanup the test collection to avoid other tests' documents causing issues with StartFromBeginning
209
- await this . ResetTestCollection ( ) ;
210
202
int documentCount = 1 ;
211
- int partitionCount = await IntegrationTestsHelper . GetPartitionCount ( this . ClassData . monitoredCollectionInfo ) ;
203
+ int partitionCount = await IntegrationTestsHelper . GetPartitionCount ( this . MonitoredCollectionInfo ) ;
212
204
int openedCount = 0 , processedCount = 0 ;
213
205
var allObserversStarted = new ManualResetEvent ( false ) ;
214
206
var allDocsProcessed = new ManualResetEvent ( false ) ;
@@ -233,7 +225,7 @@ public async Task WhenLeasesHaveContinuationTokenNullStartFromBeginning()
233
225
// We create a host to initialize the leases with ContinuationToken null
234
226
var host = new ChangeFeedEventHost (
235
227
hostName ,
236
- this . ClassData . monitoredCollectionInfo ,
228
+ this . MonitoredCollectionInfo ,
237
229
this . LeaseCollectionInfo ,
238
230
new ChangeFeedOptions { StartFromBeginning = false } ,
239
231
new ChangeFeedHostOptions ( ) ) ;
@@ -244,14 +236,14 @@ public async Task WhenLeasesHaveContinuationTokenNullStartFromBeginning()
244
236
await host . UnregisterObserversAsync ( ) ;
245
237
246
238
using ( var client = new DocumentClient (
247
- this . ClassData . monitoredCollectionInfo . Uri ,
248
- this . ClassData . monitoredCollectionInfo . MasterKey ,
249
- this . ClassData . monitoredCollectionInfo . ConnectionPolicy ) )
239
+ this . MonitoredCollectionInfo . Uri ,
240
+ this . MonitoredCollectionInfo . MasterKey ,
241
+ this . MonitoredCollectionInfo . ConnectionPolicy ) )
250
242
{
251
243
// Insert documents
252
244
await IntegrationTestsHelper . CreateDocumentsAsync (
253
245
client ,
254
- UriFactory . CreateDocumentCollectionUri ( this . ClassData . monitoredCollectionInfo . DatabaseName , this . ClassData . monitoredCollectionInfo . CollectionName ) ,
246
+ UriFactory . CreateDocumentCollectionUri ( this . MonitoredCollectionInfo . DatabaseName , this . MonitoredCollectionInfo . CollectionName ) ,
255
247
10 ) ;
256
248
257
249
// Since the leases have ContinuationToken null state, the estimator will use StartFromBeginning and pick-up the changes that happened from the start
0 commit comments