blob: 40190f4364d3f2784ca967f70f0af977d60bc475 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
test Discovery:
spawn as p1
spawn as p2
send "create-identity Device1 Owner" to p1
send "create-identity Device2" to p2
send "start-server" to p1
send "start-server" to p2
expect from p1:
/peer 1 addr ${p2.node.ip} 29665/
/peer 1 id Device2/
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1 Owner/
send "update-local-identity Device1A" to p1
expect /peer 1 id Device1A Owner/ from p2
send "update-shared-identity OwnerA" to p1
expect /peer 1 id Device1A OwnerA/ from p2
send "update-local-identity Device1B" to p1
expect /peer 1 id Device1B OwnerA/ from p2
send "update-shared-identity OwnerB" to p1
expect /peer 1 id Device1B OwnerB/ from p2
with p2:
send "stop-server"
expect /stop-server-done/
send "update-shared-identity OwnerC" to p1
with p1:
send "stop-server"
expect /stop-server-done/
spawn as p3
spawn as p4
spawn as p5
spawn as p6
send "create-identity Device3" to p3
send "create-identity Device4" to p4
send "create-identity Device5" to p5
send "create-identity Device6" to p6
for p in [ p1, p2, p3, p4, p5, p6 ]:
send "start-server" to p
expect from p1:
/peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer1_2
/peer $peer1_2 id Device2/
/peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer1_3
/peer $peer1_3 id Device3/
/peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer1_4
/peer $peer1_4 id Device4/
/peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer1_5
/peer $peer1_5 id Device5/
/peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer1_6
/peer $peer1_6 id Device6/
expect from p2:
/peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1
/peer $peer2_1 id Device1B OwnerC/
/peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer2_3
/peer $peer2_3 id Device3/
/peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer2_4
/peer $peer2_4 id Device4/
/peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer2_5
/peer $peer2_5 id Device5/
/peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer2_6
/peer $peer2_6 id Device6/
expect from p3:
/peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer3_1
/peer $peer3_1 id Device1B OwnerC/
/peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer3_2
/peer $peer3_2 id Device2/
/peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer3_4
/peer $peer3_4 id Device4/
/peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer3_5
/peer $peer3_5 id Device5/
/peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer3_6
/peer $peer3_6 id Device6/
expect from p4:
/peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer4_1
/peer $peer4_1 id Device1B OwnerC/
/peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer4_2
/peer $peer4_2 id Device2/
/peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer4_3
/peer $peer4_3 id Device3/
/peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer4_5
/peer $peer4_5 id Device5/
/peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer4_6
/peer $peer4_6 id Device6/
expect from p5:
/peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer5_1
/peer $peer5_1 id Device1B OwnerC/
/peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer5_2
/peer $peer5_2 id Device2/
/peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer5_3
/peer $peer5_3 id Device3/
/peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer5_4
/peer $peer5_4 id Device4/
/peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer5_6
/peer $peer5_6 id Device6/
expect from p6:
/peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer6_1
/peer $peer6_1 id Device1B OwnerC/
/peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer6_2
/peer $peer6_2 id Device2/
/peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer6_3
/peer $peer6_3 id Device3/
/peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer6_4
/peer $peer6_4 id Device4/
/peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer6_5
/peer $peer6_5 id Device5/
test LargeData:
spawn as p1
spawn as p2
send "create-identity Device1" to p1
send "create-identity Device2" to p2
send "start-server" to p1
send "start-server" to p2
expect from p1:
/peer 1 addr ${p2.node.ip} 29665/
/peer 1 id Device2/
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1/
for i in [0..10]:
with p1:
# Create blob with (i * 1000) bytes
send "store blob"
for j in [1 .. i * 10]:
# 100 bytes each line
send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture ref
send "test-message-send 1 $ref"
expect /test-message-send done/
expect /test-message-received blob ${i*1000} $ref/ from p2
test ManyStreams:
spawn as p1
spawn as p2
send "create-identity Device1" to p1
send "create-identity Device2" to p2
send "start-server" to p1
send "start-server" to p2
expect from p1:
/peer 1 addr ${p2.node.ip} 29665/
/peer 1 id Device2/
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1/
for i in [0..100]:
with p1:
# Create blob with 1000 bytes + decimal i
send "store blob"
for j in [1 .. 10]:
# 100 bytes each line
send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"
send "$i"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture ref
send "test-message-send 1 $ref"
expect /test-message-send done/
expect /test-message-received blob 100[2-4] $ref/ from p2
test MultipleServiceRefs:
spawn as p1
spawn as p2
send "create-identity Device1" to p1
send "create-identity Device2" to p2
send "start-server" to p1
send "start-server" to p2
expect from p1:
/peer 1 addr ${p2.node.ip} 29665/
/peer 1 id Device2/
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1/
let kbytes = 2
with p1:
send "store blob"
send "A"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture ref_a
# Create blobs with (kbytes * 1000) bytes each
send "store blob"
send "B"
for j in [1 .. kbytes * 10]:
# 100 bytes each line
send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture ref_b
send "store blob"
send "C"
for j in [1 .. kbytes * 10]:
# 100 bytes each line
send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture ref_c
send "store blob"
send "D"
for j in [1 .. kbytes * 10]:
# 100 bytes each line
send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture ref_d
send "test-message-send 1 $ref_a $ref_b $ref_c $ref_d"
expect /test-message-send done/
expect /test-message-received blob [0-9]+ $ref_a/ from p2
expect /test-message-received blob [0-9]+ $ref_b/ from p2
expect /test-message-received blob [0-9]+ $ref_c/ from p2
expect /test-message-received blob [0-9]+ $ref_d/ from p2
test Reconnection:
spawn as p1
with p1:
send "create-identity Device1"
send "start-server"
node n
local:
spawn as p2 on n
send "create-identity Device2" to p2
send "start-server" to p2
expect from p1:
/peer 1 addr ${p2.node.ip} 29665/
/peer 1 id Device2/
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1/
with p1:
send "store blob"
send "message1"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture message
send "test-message-send 1 $message"
expect /test-message-send done/
expect /test-message-received blob [0-9]+ $message/ from p2
send "peer-list"
expect /peer-list-item 1 addr ${p2.node.ip} 29665 id Device2/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
# Restart process on node 'n'
local:
spawn as p2 on n
send "start-server" to p2
send "peer-add ${p1.node.ip}" to p2
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1/
with p1:
send "store blob"
send "message2"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture message
send "test-message-send 1 $message"
expect /test-message-send done/
expect /test-message-received blob [0-9]+ $message/ from p2
# Drop and re-add peer p2:
with p1:
send "peer-list"
expect /peer-list-item 1 addr ${p2.node.ip} 29665 id Device2/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "peer-drop 1"
send "peer-list"
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "peer-add ${p2.node.ip}"
expect /peer 2 addr ${p2.node.ip} 29665/
expect /peer 2 id Device2/
send "peer-list"
expect /peer-list-item 2 addr ${p2.node.ip} 29665 id Device2/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "store blob"
send "message3"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture message
send "test-message-send 2 $message"
expect /test-message-send done/
expect /test-message-received blob [0-9]+ $message/ from p2
# Drop on both sides and re-add:
with p2:
send "peer-list"
expect /peer-list-item 1 addr ${p1.node.ip} 29665 id Device1/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "peer-drop 1"
send "peer-list"
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
with p1:
send "peer-list"
expect /peer-list-item 2 addr ${p2.node.ip} 29665 id Device2/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "peer-drop 2"
send "peer-list"
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "peer-add ${p1.node.ip}" to p2
with p2:
expect /peer 2 addr ${p1.node.ip} 29665/ from p2
expect /peer 2 id Device1/ from p2
send "peer-list"
expect /peer-list-item 2 addr ${p1.node.ip} 29665 id Device1/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
send "store blob"
send "message4"
send ""
expect /store-done (blake2#[0-9a-f]*)/ capture message
send "test-message-send 2 $message"
expect /test-message-send done/
with p1:
expect /peer 3 addr ${p2.node.ip} 29665/
expect /peer 3 id Device2/
send "peer-list"
expect /peer-list-item 3 addr ${p2.node.ip} 29665 id Device2/
local:
expect /peer-list-(.*)/ capture done
guard (done == "done")
expect /test-message-received blob [0-9]+ $message/
test SendUnknownObjectType:
let refpat = /blake2#[0-9a-f]*/
spawn as p1
spawn as p2
with p1:
send "create-identity Device1"
send "start-server"
with p2:
send "create-identity Device2"
send "start-server"
expect from p1:
/peer 1 addr ${p2.node.ip} 29665/
/peer 1 id Device2/
expect from p2:
/peer 1 addr ${p1.node.ip} 29665/
/peer 1 id Device1/
with p1:
send:
"store test-unknown"
"TEST"
""
expect /store-done ($refpat)/ capture r1
send:
"store rec"
"test:unknown TEST"
""
expect /store-done ($refpat)/ capture r2
send "test-message-send 1 $r1"
expect /test-message-send done/
with p2:
expect /test-message-received test-unknown [0-9]+ $r1/
send "load $r1"
expect /load-type test-unknown 5/
expect /load-line TEST/
local:
expect /load-(.*)/ capture done
guard (done == "done")
send "test-message-send 1 $r2"
expect /test-message-send done/
with p2:
expect /test-message-received rec [0-9]+ $r2/
send "load $r2"
expect /load-type rec [0-9]+/
expect /load-line test:unknown TEST/
local:
expect /load-(.*)/ capture done
guard (done == "done")
|