@@ -73,11 +73,11 @@ void main() {
73
73
buckets: [
74
74
bucketDescription ('a' ,
75
75
subscriptions: [
76
- {'def ' : 'my_default_stream' }
76
+ {'default ' : 0 }
77
77
],
78
78
priority: 1 ),
79
79
],
80
- streams: [('my_default_stream' , true )],
80
+ streams: [stream ('my_default_stream' , true )],
81
81
),
82
82
),
83
83
);
@@ -122,7 +122,7 @@ void main() {
122
122
syncTest ('are deleted' , (_) {
123
123
control ('start' , null );
124
124
125
- for (final stream in ['s1' , 's2' ]) {
125
+ for (final name in ['s1' , 's2' ]) {
126
126
control (
127
127
'line_text' ,
128
128
json.encode (
@@ -131,11 +131,11 @@ void main() {
131
131
buckets: [
132
132
bucketDescription ('a' ,
133
133
subscriptions: [
134
- {'def ' : stream }
134
+ {'default ' : 0 }
135
135
],
136
136
priority: 1 ),
137
137
],
138
- streams: [( stream, true )],
138
+ streams: [stream (name , true )],
139
139
),
140
140
),
141
141
);
@@ -164,11 +164,11 @@ void main() {
164
164
buckets: [
165
165
bucketDescription ('a' ,
166
166
subscriptions: [
167
- {'def ' : 'a' }
167
+ {'default ' : 0 }
168
168
],
169
169
priority: 1 ),
170
170
],
171
- streams: [('a' , true )],
171
+ streams: [stream ('a' , true )],
172
172
),
173
173
),
174
174
);
@@ -210,6 +210,41 @@ void main() {
210
210
expect (stored, containsPair ('is_default' , 0 ));
211
211
expect (stored, containsPair ('ttl' , isNotNull));
212
212
});
213
+
214
+ syncTest ('reports errors' , (_) {
215
+ control ('start' , null );
216
+ final response = control (
217
+ 'line_text' ,
218
+ json.encode (
219
+ checkpoint (
220
+ lastOpId: 1 ,
221
+ buckets: [
222
+ bucketDescription ('a' ,
223
+ subscriptions: [
224
+ {'default' : 0 }
225
+ ],
226
+ priority: 1 ),
227
+ ],
228
+ streams: [
229
+ stream ('a' , true , errors: [
230
+ {'message' : 'error message' , 'subscription' : 'default' }
231
+ ])
232
+ ],
233
+ ),
234
+ ),
235
+ );
236
+
237
+ expect (
238
+ response,
239
+ contains (
240
+ containsPair (
241
+ 'LogLine' ,
242
+ containsPair (
243
+ 'line' , 'Default subscription a has errors: error message' ),
244
+ ),
245
+ ),
246
+ );
247
+ });
213
248
});
214
249
215
250
group ('explicit subscriptions' , () {
@@ -300,7 +335,6 @@ void main() {
300
335
'stream' : 'my_stream' ,
301
336
'parameters' : null ,
302
337
'override_priority' : null ,
303
- 'client_id' : '1' ,
304
338
}
305
339
],
306
340
},
@@ -348,7 +382,7 @@ void main() {
348
382
checkpoint (
349
383
lastOpId: 1 ,
350
384
buckets: [],
351
- streams: [('a' , true )],
385
+ streams: [stream ('a' , true )],
352
386
),
353
387
),
354
388
);
@@ -386,5 +420,76 @@ void main() {
386
420
),
387
421
);
388
422
});
423
+
424
+ syncTest ('reports errors' , (_) {
425
+ control (
426
+ 'subscriptions' ,
427
+ json.encode ({
428
+ 'subscribe' : {'stream' : 'a' , 'params' : 'invalid' }
429
+ }),
430
+ );
431
+ control (
432
+ 'subscriptions' ,
433
+ json.encode ({
434
+ 'subscribe' : {'stream' : 'a' , 'params' : 'valid' }
435
+ }),
436
+ );
437
+
438
+ final start = control ('start' , null );
439
+ expect (
440
+ start,
441
+ contains (
442
+ containsPair (
443
+ 'EstablishSyncStream' ,
444
+ containsPair (
445
+ 'request' ,
446
+ containsPair (
447
+ 'streams' ,
448
+ {
449
+ 'include_defaults' : true ,
450
+ 'subscriptions' : [
451
+ {
452
+ 'stream' : 'a' ,
453
+ 'parameters' : 'invalid' ,
454
+ 'override_priority' : null
455
+ },
456
+ {
457
+ 'stream' : 'a' ,
458
+ 'parameters' : 'valid' ,
459
+ 'override_priority' : null
460
+ }
461
+ ]
462
+ },
463
+ ),
464
+ ),
465
+ ),
466
+ ),
467
+ );
468
+ final response = control (
469
+ 'line_text' ,
470
+ json.encode (
471
+ checkpoint (
472
+ lastOpId: 1 ,
473
+ buckets: [],
474
+ streams: [
475
+ stream ('a' , true , errors: [
476
+ {'message' : 'error message' , 'subscription' : 0 }
477
+ ])
478
+ ],
479
+ ),
480
+ ),
481
+ );
482
+
483
+ expect (
484
+ response,
485
+ contains (
486
+ containsPair (
487
+ 'LogLine' ,
488
+ containsPair ('line' ,
489
+ 'Subscription to stream a (with parameters "invalid") could not be resolved: error message' ),
490
+ ),
491
+ ),
492
+ );
493
+ });
389
494
});
390
495
}
0 commit comments