@@ -26,7 +26,9 @@ describe("reconnect", () => {
26
26
// make successful append to connect to node
27
27
const firstAppend = await client . appendToStream (
28
28
"my_stream" ,
29
- jsonEvent ( { type : "first-append" , data : { message : "test" } } )
29
+ jsonEvent ( { type : "first-append" , data : { message : "test" } } ) ,
30
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
31
+ { credentials : { username : "admin" , password : "changeit" } }
30
32
) ;
31
33
expect ( firstAppend ) . toBeDefined ( ) ;
32
34
@@ -38,7 +40,9 @@ describe("reconnect", () => {
38
40
try {
39
41
const secondAppend = await client . appendToStream (
40
42
"my_stream" ,
41
- jsonEvent ( { type : "failed-append" , data : { message : "test" } } )
43
+ jsonEvent ( { type : "failed-append" , data : { message : "test" } } ) ,
44
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
45
+ { credentials : { username : "admin" , password : "changeit" } }
42
46
) ;
43
47
expect ( secondAppend ) . toBe ( "Unreachable" ) ;
44
48
} catch ( error ) {
@@ -52,7 +56,9 @@ describe("reconnect", () => {
52
56
try {
53
57
const reconnectedAppend = await client . appendToStream (
54
58
"my_stream" ,
55
- jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } )
59
+ jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } ) ,
60
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
61
+ { credentials : { username : "admin" , password : "changeit" } }
56
62
) ;
57
63
expect ( reconnectedAppend ) . toBeDefined ( ) ;
58
64
break ;
@@ -79,7 +85,9 @@ describe("reconnect", () => {
79
85
// make successful append to follower node
80
86
const firstAppend = await client . appendToStream (
81
87
"my_stream" ,
82
- jsonEvent ( { type : "first-append" , data : { message : "test" } } )
88
+ jsonEvent ( { type : "first-append" , data : { message : "test" } } ) ,
89
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
90
+ { credentials : { username : "admin" , password : "changeit" } }
83
91
) ;
84
92
expect ( firstAppend ) . toBeDefined ( ) ;
85
93
@@ -89,7 +97,11 @@ describe("reconnect", () => {
89
97
const secondAppend = await client . appendToStream (
90
98
"my_stream" ,
91
99
jsonEvent ( { type : "failed-append" , data : { message : "test" } } ) ,
92
- { requiresLeader : true }
100
+ {
101
+ requiresLeader : true ,
102
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
103
+ credentials : { username : "admin" , password : "changeit" } ,
104
+ }
93
105
) ;
94
106
expect ( secondAppend ) . toBe ( "Unreachable" ) ;
95
107
} catch ( error ) {
@@ -104,7 +116,11 @@ describe("reconnect", () => {
104
116
const reconnectedAppend = await client . appendToStream (
105
117
"my_stream" ,
106
118
jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } ) ,
107
- { requiresLeader : true }
119
+ {
120
+ requiresLeader : true ,
121
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
122
+ credentials : { username : "admin" , password : "changeit" } ,
123
+ }
108
124
) ;
109
125
expect ( reconnectedAppend ) . toBeDefined ( ) ;
110
126
@@ -129,7 +145,9 @@ describe("reconnect", () => {
129
145
// make successful append of 2000 events to node
130
146
const firstAppend = await client . appendToStream (
131
147
"my_stream" ,
132
- jsonTestEvents ( 2000 )
148
+ jsonTestEvents ( 2000 ) ,
149
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
150
+ { credentials : { username : "admin" , password : "changeit" } }
133
151
) ;
134
152
expect ( firstAppend ) . toBeDefined ( ) ;
135
153
@@ -159,7 +177,8 @@ describe("reconnect", () => {
159
177
try {
160
178
const reconnectedAppend = await client . appendToStream (
161
179
"my_stream" ,
162
- jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } )
180
+ jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } ) , // batch append triggers reconnect as soon as stream drops, so we need to force regular append
181
+ { credentials : { username : "admin" , password : "changeit" } }
163
182
) ;
164
183
expect ( reconnectedAppend ) . toBeDefined ( ) ;
165
184
break ;
@@ -186,7 +205,9 @@ describe("reconnect", () => {
186
205
// make successful append to connect to node
187
206
const firstAppend = await client . appendToStream (
188
207
"my_stream" ,
189
- jsonEvent ( { type : "first-append" , data : { message : "test" } } )
208
+ jsonEvent ( { type : "first-append" , data : { message : "test" } } ) ,
209
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
210
+ { credentials : { username : "admin" , password : "changeit" } }
190
211
) ;
191
212
expect ( firstAppend ) . toBeDefined ( ) ;
192
213
@@ -199,7 +220,9 @@ describe("reconnect", () => {
199
220
try {
200
221
const secondAppend = await client . appendToStream (
201
222
"my_stream" ,
202
- jsonEvent ( { type : "failed-append" , data : { message : "test" } } )
223
+ jsonEvent ( { type : "failed-append" , data : { message : "test" } } ) ,
224
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
225
+ { credentials : { username : "admin" , password : "changeit" } }
203
226
) ;
204
227
expect ( secondAppend ) . toBe ( "Unreachable" ) ;
205
228
} catch ( error ) {
@@ -210,7 +233,9 @@ describe("reconnect", () => {
210
233
try {
211
234
const secondAppend = await client . appendToStream (
212
235
"my_stream" ,
213
- jsonEvent ( { type : "failed-append" , data : { message : "test" } } )
236
+ jsonEvent ( { type : "failed-append" , data : { message : "test" } } ) ,
237
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
238
+ { credentials : { username : "admin" , password : "changeit" } }
214
239
) ;
215
240
expect ( secondAppend ) . toBe ( "Unreachable" ) ;
216
241
} catch ( error ) {
@@ -229,7 +254,9 @@ describe("reconnect", () => {
229
254
try {
230
255
const reconnectedAppend = await client . appendToStream (
231
256
"my_stream" ,
232
- jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } )
257
+ jsonEvent ( { type : "reconnect-append" , data : { message : "test" } } ) ,
258
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
259
+ { credentials : { username : "admin" , password : "changeit" } }
233
260
) ;
234
261
expect ( reconnectedAppend ) . toBeDefined ( ) ;
235
262
break ;
@@ -257,7 +284,9 @@ describe("reconnect", () => {
257
284
// make successful append to connect to node
258
285
const firstAppend = await client . appendToStream (
259
286
"my_stream" ,
260
- jsonEvent ( { type : "first-append" , data : { message : "test" } } )
287
+ jsonEvent ( { type : "first-append" , data : { message : "test" } } ) ,
288
+ // batch append triggers reconnect as soon as stream drops, so we need to force regular append
289
+ { credentials : { username : "admin" , password : "changeit" } }
261
290
) ;
262
291
expect ( firstAppend ) . toBeDefined ( ) ;
263
292
0 commit comments