This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
/
gizzmo_spec.rb
556 lines (471 loc) · 24 KB
/
gizzmo_spec.rb
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
require File.expand_path('../spec_helper.rb', __FILE__)
describe "gizzmo (cli)" do
def gizzmo(cmd)
`cd #{ROOT_DIR} && ruby -rubygems -Ilib bin/gizzmo -H localhost -P #{MANAGER_PORT} #{cmd} 2>&1`
end
def nameserver
@nameserver ||= read_nameserver_db
end
before do
reset_nameserver
@nameserver = nil
end
describe "basic manipulation commands" do
describe "create" do
it "creates a single shard" do
gizzmo "create TestShard localhost/t0_0"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard")]
end
it "creates multiple shards" do
gizzmo "create TestShard localhost/t0_0 localhost/t0_1"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
info("localhost", "t0_1", "TestShard")]
end
it "honors source and destination types" do
gizzmo "create TestShard -s int -d long localhost/t0_0"
gizzmo "create TestShard --source-type=int --destination-type=long localhost/t0_1"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard", "int", "long"),
info("localhost", "t0_1", "TestShard", "int", "long")]
end
end
describe "delete" do
it "deletes a shard" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "delete localhost/t0_0"
nameserver[:shards].should == []
end
end
describe "wrap/unwrap" do
before do
gizzmo "create TestShard localhost/t0_0"
gizzmo "create ReplicatingShard localhost/t0_0_replicating"
gizzmo "addlink localhost/t0_0_replicating localhost/t0_0 1"
gizzmo "wrap BlockedShard localhost/t0_0"
end
it "wrap wraps a shard" do
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
info("localhost", "t0_0_blocked", "BlockedShard"),
info("localhost", "t0_0_replicating", "ReplicatingShard")]
nameserver[:links].should == [link(id("localhost", "t0_0_blocked"), id("localhost", "t0_0"), 1),
link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0_blocked"), 1)]
end
it "unwrap unwraps a shard" do
gizzmo "unwrap localhost/t0_0_blocked"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
info("localhost", "t0_0_replicating", "ReplicatingShard")]
nameserver[:links].should == [link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0"), 1)]
end
it "unwrap doesn't unwrap a top level shard or a leaf" do
gizzmo "unwrap localhost/t0_0"
gizzmo "unwrap localhost/t0_0_replicating"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
info("localhost", "t0_0_blocked", "BlockedShard"),
info("localhost", "t0_0_replicating", "ReplicatingShard")]
nameserver[:links].should == [link(id("localhost", "t0_0_blocked"), id("localhost", "t0_0"), 1),
link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0_blocked"), 1)]
end
end
describe "markbusy" do
it "marks shards busy" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "markbusy localhost/t0_0"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard", "", "", 1)]
end
end
describe "markunbusy" do
it "marks shards as not busy" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "markbusy localhost/t0_0"
gizzmo "markunbusy localhost/t0_0"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard", "", "", 0)]
end
end
describe "addforwarding" do
it "adds a forwarding" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "addforwarding 0 0 localhost/t0_0"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard")]
nameserver[:forwardings].should == [forwarding(0, 0, id("localhost", "t0_0"))]
end
end
describe "deleteforwarding" do
it "removes a forwarding" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "addforwarding 0 0 localhost/t0_0"
gizzmo "deleteforwarding 0 0 localhost/t0_0"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard")]
nameserver[:forwardings].should == []
end
end
describe "addlink" do
it "links two shards" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "create ReplicatingShard localhost/t0_0_replicating"
gizzmo "addlink localhost/t0_0_replicating localhost/t0_0 1"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
info("localhost", "t0_0_replicating", "ReplicatingShard")]
nameserver[:links].should == [link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0"), 1)]
end
end
describe "unlink" do
it "unlinks two shards" do
gizzmo "create TestShard localhost/t0_0"
gizzmo "create ReplicatingShard localhost/t0_0_replicating"
gizzmo "addlink localhost/t0_0_replicating localhost/t0_0 1"
gizzmo "unlink localhost/t0_0_replicating localhost/t0_0"
nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
info("localhost", "t0_0_replicating", "ReplicatingShard")]
nameserver[:links].should == []
end
end
describe "add-host" do
it "creates single and multiple hosts" do
gizzmo "add-host c1:c1host1:7777"
gizzmo "add-host c2:c2host1:7777 c2:c2host2:7777"
nameserver[:hosts].should == [ host("c1host1", 7777, "c1"),
host("c2host1", 7777, "c2"),
host("c2host2", 7777, "c2") ]
end
end
describe "remove-host" do
it "creates single and multiple hosts" do
gizzmo "add-host c1:c1host1:7777"
gizzmo "remove-host c1:c1host1:7777"
nameserver[:hosts].should == []
end
end
end
describe "basic read methods" do
before do
3.times do |i|
gizzmo "create TestShard -s Int -d Int localhost/t0_#{i}_a 127.0.0.1/t0_#{i}_b"
gizzmo "create ReplicatingShard localhost/t0_#{i}_replicating"
gizzmo "addlink localhost/t0_#{i}_replicating localhost/t0_#{i}_a 1"
gizzmo "addlink localhost/t0_#{i}_replicating 127.0.0.1/t0_#{i}_b 1"
gizzmo "addforwarding 0 #{i} localhost/t0_#{i}_replicating"
end
end
describe "subtree" do
it "prints the tree for a shard" do
results = "localhost/t0_0_replicating\n 127.0.0.1/t0_0_b\n localhost/t0_0_a\n"
gizzmo("subtree localhost/t0_0_replicating").should == results
gizzmo("subtree localhost/t0_0_a").should == results
gizzmo("subtree 127.0.0.1/t0_0_b").should == results
end
end
describe "hosts" do
it "prints a list of unique hosts" do
gizzmo("hosts").should == "127.0.0.1\nlocalhost\n"
end
end
describe "forwardings" do
it "lists forwardings and the root of the corresponding shard trees" do
gizzmo("forwardings").should == <<-EOF
0\t0\tlocalhost/t0_0_replicating
0\t1\tlocalhost/t0_1_replicating
0\t2\tlocalhost/t0_2_replicating
EOF
end
end
describe "links" do
it "lists links associated withe the given shards" do
gizzmo("links localhost/t0_0_a localhost/t0_1_a").should == <<-EOF
localhost/t0_0_replicating\tlocalhost/t0_0_a\t1
localhost/t0_1_replicating\tlocalhost/t0_1_a\t1
EOF
end
end
describe "info" do
it "outputs shard info for the given shard ids" do
gizzmo("info localhost/t0_0_a 127.0.0.1/t0_1_b localhost/t0_2_replicating").should == <<-EOF
localhost/t0_0_a\tTestShard\tok
127.0.0.1/t0_1_b\tTestShard\tok
localhost/t0_2_replicating\tReplicatingShard\tok
EOF
end
end
describe "busy" do
it "lists all busy shards" do
gizzmo "markbusy localhost/t0_0_a localhost/t0_1_a localhost/t0_2_a"
gizzmo("busy").should == <<-EOF
localhost/t0_0_a\tTestShard\tbusy
localhost/t0_1_a\tTestShard\tbusy
localhost/t0_2_a\tTestShard\tbusy
EOF
end
end
describe "list-hosts" do
it "returns a list of all hosts and their status" do
gizzmo("add-host c1:c1host1:7777 c2:c2host1:7777 c2:c2host2:7777")
gizzmo("list-hosts").should == <<-EOF
c1:c1host1:7777 0
c2:c2host1:7777 0
c2:c2host2:7777 0
EOF
end
end
describe "topology" do
it "lists counts for each template" do
gizzmo("-T 0 topology").should == <<-EOF
3 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
EOF
end
it "shows the template for each forwarding" do
gizzmo("-T 0 topology --forwardings").should == <<-EOF
0 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
1 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
2 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
EOF
end
end
end
describe "find" do
it "works"
end
describe "rebalance" do
it "works"
end
describe "repair" do
it "works"
end
describe "reload" do
it "works"
end
describe "drill" do
it "works"
end
describe "pair" do
it "works"
end
describe "report" do
it "works"
end
describe "lookup" do
it "works"
end
describe "copy" do
it "works"
end
describe "setup-migrate" do
it "works"
end
describe "finish-migrate" do
it "works"
end
describe "inject" do
it "works"
end
describe "flush" do
it "works"
end
describe "transform-tree" do
it "works" do
gizzmo "create -s Int -d Int TestShard localhost/s_0_001_a"
#gizzmo "create TestShard 127.0.0.1/s_0_001_b"
gizzmo "create ReplicatingShard localhost/s_0_001_replicating"
gizzmo "addlink localhost/s_0_001_replicating localhost/s_0_001_a 1"
#gizzmo "addlink localhost/s_0_001_replicating 127.0.0.1/s_0_001_b 1"
gizzmo "addforwarding 0 1 localhost/s_0_001_replicating"
gizzmo "-f reload"
gizzmo('-f transform-tree --no-progress --poll-interval=1 "ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1))" localhost/s_0_001_replicating').should == <<-EOF
ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
PREPARE
create_shard(TestShard/127.0.0.1)
create_shard(WriteOnlyShard)
add_link(WriteOnlyShard -> TestShard/127.0.0.1)
add_link(ReplicatingShard -> WriteOnlyShard)
COPY
copy_shard(TestShard/127.0.0.1)
CLEANUP
add_link(ReplicatingShard -> TestShard/127.0.0.1)
remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
remove_link(ReplicatingShard -> WriteOnlyShard)
delete_shard(WriteOnlyShard)
STARTING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
COPIES:
localhost/s_0_001_a -> 127.0.0.1/s_0_0001
FINISHING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
1 transformation applied. Total time elapsed: 1 second
EOF
nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_001_replicating", "ReplicatingShard") ]
nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1) ]
end
end
describe "transform" do
it "works" do
1.upto(2) do |i|
gizzmo "create TestShard -s Int -d Int localhost/s_0_00#{i}_a"
#gizzmo "create TestShard -s Int -d Int 127.0.0.1/s_0_000#{i}_b"
gizzmo "create ReplicatingShard localhost/s_0_00#{i}_replicating"
gizzmo "addlink localhost/s_0_00#{i}_replicating localhost/s_0_00#{i}_a 1"
#gizzmo "addlink localhost/s_0_00#{i}_replicating 127.0.0.1/s_0_000#{i}_b 1"
gizzmo "addforwarding 0 #{i} localhost/s_0_00#{i}_replicating"
end
gizzmo "-f reload"
gizzmo('-f -T0 transform --no-progress --poll-interval=1 "ReplicatingShard -> TestShard(localhost,1,Int,Int)" "ReplicatingShard -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1))"').should == <<-EOF
ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
PREPARE
create_shard(TestShard/127.0.0.1)
create_shard(WriteOnlyShard)
add_link(WriteOnlyShard -> TestShard/127.0.0.1)
add_link(ReplicatingShard -> WriteOnlyShard)
COPY
copy_shard(TestShard/127.0.0.1)
CLEANUP
add_link(ReplicatingShard -> TestShard/127.0.0.1)
remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
remove_link(ReplicatingShard -> WriteOnlyShard)
delete_shard(WriteOnlyShard)
Applied to 2 shards:
[0] 1 = localhost/s_0_001_replicating
[0] 2 = localhost/s_0_002_replicating
STARTING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[0] 2 = localhost/s_0_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
COPIES:
localhost/s_0_001_a -> 127.0.0.1/s_0_0001
localhost/s_0_002_a -> 127.0.0.1/s_0_0002
FINISHING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[0] 2 = localhost/s_0_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
2 transformations applied. Total time elapsed: 1 second
EOF
nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
info("127.0.0.1", "s_0_0002", "TestShard"),
info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_001_replicating", "ReplicatingShard"),
info("localhost", "s_0_002_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_002_replicating", "ReplicatingShard") ]
nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1),
link(id("localhost", "s_0_002_replicating"), id("127.0.0.1", "s_0_0002"), 1),
link(id("localhost", "s_0_002_replicating"), id("localhost", "s_0_002_a"), 1) ]
end
it "works with multiple pages" do
1.upto(2) do |i|
gizzmo "create TestShard -s Int -d Int localhost/s_0_00#{i}_a"
#gizzmo "create TestShard -s Int -d Int 127.0.0.1/s_0_000#{i}_b"
gizzmo "create ReplicatingShard localhost/s_0_00#{i}_replicating"
gizzmo "addlink localhost/s_0_00#{i}_replicating localhost/s_0_00#{i}_a 1"
#gizzmo "addlink localhost/s_0_00#{i}_replicating 127.0.0.1/s_0_000#{i}_b 1"
gizzmo "addforwarding 0 #{i} localhost/s_0_00#{i}_replicating"
end
gizzmo "-f reload"
gizzmo('-f -T0 transform --no-progress --poll-interval=1 --max-copies=1 "ReplicatingShard -> TestShard(localhost,1,Int,Int)" "ReplicatingShard -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1))"').should == <<-EOF
ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
PREPARE
create_shard(TestShard/127.0.0.1)
create_shard(WriteOnlyShard)
add_link(WriteOnlyShard -> TestShard/127.0.0.1)
add_link(ReplicatingShard -> WriteOnlyShard)
COPY
copy_shard(TestShard/127.0.0.1)
CLEANUP
add_link(ReplicatingShard -> TestShard/127.0.0.1)
remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
remove_link(ReplicatingShard -> WriteOnlyShard)
delete_shard(WriteOnlyShard)
Applied to 2 shards:
[0] 1 = localhost/s_0_001_replicating
[0] 2 = localhost/s_0_002_replicating
STARTING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
COPIES:
localhost/s_0_001_a -> 127.0.0.1/s_0_0001
FINISHING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
STARTING:
[0] 2 = localhost/s_0_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
COPIES:
localhost/s_0_002_a -> 127.0.0.1/s_0_0002
FINISHING:
[0] 2 = localhost/s_0_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
2 transformations applied. Total time elapsed: 2 seconds
EOF
nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
info("127.0.0.1", "s_0_0002", "TestShard"),
info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_001_replicating", "ReplicatingShard"),
info("localhost", "s_0_002_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_002_replicating", "ReplicatingShard") ]
nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1),
link(id("localhost", "s_0_002_replicating"), id("127.0.0.1", "s_0_0002"), 1),
link(id("localhost", "s_0_002_replicating"), id("localhost", "s_0_002_a"), 1) ]
end
it "works with multiple forwarding tables" do
0.upto(1) do |table|
1.upto(2) do |i|
gizzmo "create TestShard -s Int -d Int localhost/s_#{table}_00#{i}_a"
#gizzmo "create TestShard -s Int -d Int 127.0.0.1/s_#{table}_000#{i}_b"
gizzmo "create ReplicatingShard localhost/s_#{table}_00#{i}_replicating"
gizzmo "addlink localhost/s_#{table}_00#{i}_replicating localhost/s_#{table}_00#{i}_a 1"
#gizzmo "addlink localhost/s_#{table}_00#{i}_replicating 127.0.0.1/s_#{table}_000#{i}_b 1"
gizzmo "addforwarding #{table} #{i} localhost/s_#{table}_00#{i}_replicating"
end
end
gizzmo "-f reload"
gizzmo('-f -T0,1 transform --no-progress --poll-interval=1 "ReplicatingShard -> TestShard(localhost,1,Int,Int)" "ReplicatingShard -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1))"').should == <<-EOF
ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
PREPARE
create_shard(TestShard/127.0.0.1)
create_shard(WriteOnlyShard)
add_link(WriteOnlyShard -> TestShard/127.0.0.1)
add_link(ReplicatingShard -> WriteOnlyShard)
COPY
copy_shard(TestShard/127.0.0.1)
CLEANUP
add_link(ReplicatingShard -> TestShard/127.0.0.1)
remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
remove_link(ReplicatingShard -> WriteOnlyShard)
delete_shard(WriteOnlyShard)
Applied to 4 shards:
[0] 1 = localhost/s_0_001_replicating
[0] 2 = localhost/s_0_002_replicating
[1] 1 = localhost/s_1_001_replicating
[1] 2 = localhost/s_1_002_replicating
STARTING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[0] 2 = localhost/s_0_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[1] 1 = localhost/s_1_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[1] 2 = localhost/s_1_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
COPIES:
localhost/s_0_001_a -> 127.0.0.1/s_0_0001
localhost/s_0_002_a -> 127.0.0.1/s_0_0002
localhost/s_1_001_a -> 127.0.0.1/s_1_0001
localhost/s_1_002_a -> 127.0.0.1/s_1_0002
FINISHING:
[0] 1 = localhost/s_0_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[0] 2 = localhost/s_0_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[1] 1 = localhost/s_1_001_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
[1] 2 = localhost/s_1_002_replicating: ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1))
4 transformations applied. Total time elapsed: 1 second
EOF
nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
info("127.0.0.1", "s_0_0002", "TestShard"),
info("127.0.0.1", "s_1_0001", "TestShard"),
info("127.0.0.1", "s_1_0002", "TestShard"),
info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_001_replicating", "ReplicatingShard"),
info("localhost", "s_0_002_a", "TestShard", "Int", "Int"),
info("localhost", "s_0_002_replicating", "ReplicatingShard"),
info("localhost", "s_1_001_a", "TestShard", "Int", "Int"),
info("localhost", "s_1_001_replicating", "ReplicatingShard"),
info("localhost", "s_1_002_a", "TestShard", "Int", "Int"),
info("localhost", "s_1_002_replicating", "ReplicatingShard") ]
nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1),
link(id("localhost", "s_0_002_replicating"), id("127.0.0.1", "s_0_0002"), 1),
link(id("localhost", "s_0_002_replicating"), id("localhost", "s_0_002_a"), 1),
link(id("localhost", "s_1_001_replicating"), id("127.0.0.1", "s_1_0001"), 1),
link(id("localhost", "s_1_001_replicating"), id("localhost", "s_1_001_a"), 1),
link(id("localhost", "s_1_002_replicating"), id("127.0.0.1", "s_1_0002"), 1),
link(id("localhost", "s_1_002_replicating"), id("localhost", "s_1_002_a"), 1) ]
end
end
end