gizzmo 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,499 @@
1
+ require File.expand_path('../spec_helper.rb', __FILE__)
2
+
3
+ describe "gizzmo (cli)" do
4
+ def gizzmo(cmd)
5
+ `cd #{ROOT_DIR} && ruby -rubygems -Ilib bin/gizzmo -H localhost -P #{MANAGER_PORT} #{cmd} 2>&1`
6
+ end
7
+
8
+ def nameserver
9
+ @nameserver ||= read_nameserver_db
10
+ end
11
+
12
+ before do
13
+ reset_nameserver
14
+ @nameserver = nil
15
+ end
16
+
17
+ describe "basic manipulation commands" do
18
+ describe "create" do
19
+ it "creates a single shard" do
20
+ gizzmo "create TestShard localhost/t0_0"
21
+
22
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard")]
23
+ end
24
+
25
+ it "creates multiple shards" do
26
+ gizzmo "create TestShard localhost/t0_0 localhost/t0_1"
27
+
28
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
29
+ info("localhost", "t0_1", "TestShard")]
30
+ end
31
+
32
+ it "honors source and destination types" do
33
+ gizzmo "create TestShard -s int -d long localhost/t0_0"
34
+ gizzmo "create TestShard --source-type=int --destination-type=long localhost/t0_1"
35
+
36
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard", "int", "long"),
37
+ info("localhost", "t0_1", "TestShard", "int", "long")]
38
+ end
39
+ end
40
+
41
+ describe "delete" do
42
+ it "deletes a shard" do
43
+ gizzmo "create TestShard localhost/t0_0"
44
+ gizzmo "delete localhost/t0_0"
45
+
46
+ nameserver[:shards].should == []
47
+ end
48
+ end
49
+
50
+ describe "wrap/unwrap" do
51
+ before do
52
+ gizzmo "create TestShard localhost/t0_0"
53
+ gizzmo "create ReplicatingShard localhost/t0_0_replicating"
54
+ gizzmo "addlink localhost/t0_0_replicating localhost/t0_0 1"
55
+
56
+ gizzmo "wrap BlockedShard localhost/t0_0"
57
+ end
58
+
59
+ it "wrap wraps a shard" do
60
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
61
+ info("localhost", "t0_0_blocked", "BlockedShard"),
62
+ info("localhost", "t0_0_replicating", "ReplicatingShard")]
63
+
64
+ nameserver[:links].should == [link(id("localhost", "t0_0_blocked"), id("localhost", "t0_0"), 1),
65
+ link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0_blocked"), 1)]
66
+ end
67
+
68
+ it "unwrap unwraps a shard" do
69
+ gizzmo "unwrap localhost/t0_0_blocked"
70
+
71
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
72
+ info("localhost", "t0_0_replicating", "ReplicatingShard")]
73
+
74
+ nameserver[:links].should == [link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0"), 1)]
75
+ end
76
+
77
+ it "unwrap doesn't unwrap a top level shard or a leaf" do
78
+ gizzmo "unwrap localhost/t0_0"
79
+ gizzmo "unwrap localhost/t0_0_replicating"
80
+
81
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
82
+ info("localhost", "t0_0_blocked", "BlockedShard"),
83
+ info("localhost", "t0_0_replicating", "ReplicatingShard")]
84
+
85
+ nameserver[:links].should == [link(id("localhost", "t0_0_blocked"), id("localhost", "t0_0"), 1),
86
+ link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0_blocked"), 1)]
87
+ end
88
+ end
89
+
90
+ describe "markbusy" do
91
+ it "marks shards busy" do
92
+ gizzmo "create TestShard localhost/t0_0"
93
+ gizzmo "markbusy localhost/t0_0"
94
+
95
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard", "", "", 1)]
96
+ end
97
+ end
98
+
99
+ describe "markunbusy" do
100
+ it "marks shards as not busy" do
101
+ gizzmo "create TestShard localhost/t0_0"
102
+ gizzmo "markbusy localhost/t0_0"
103
+ gizzmo "markunbusy localhost/t0_0"
104
+
105
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard", "", "", 0)]
106
+ end
107
+ end
108
+
109
+ describe "addforwarding" do
110
+ it "adds a forwarding" do
111
+ gizzmo "create TestShard localhost/t0_0"
112
+ gizzmo "addforwarding 0 0 localhost/t0_0"
113
+
114
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard")]
115
+ nameserver[:forwardings].should == [forwarding(0, 0, id("localhost", "t0_0"))]
116
+ end
117
+ end
118
+
119
+ describe "deleteforwarding" do
120
+ it "removes a forwarding" do
121
+ gizzmo "create TestShard localhost/t0_0"
122
+ gizzmo "addforwarding 0 0 localhost/t0_0"
123
+ gizzmo "deleteforwarding 0 0 localhost/t0_0"
124
+
125
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard")]
126
+ nameserver[:forwardings].should == []
127
+ end
128
+ end
129
+
130
+ describe "addlink" do
131
+ it "links two shards" do
132
+ gizzmo "create TestShard localhost/t0_0"
133
+ gizzmo "create ReplicatingShard localhost/t0_0_replicating"
134
+ gizzmo "addlink localhost/t0_0_replicating localhost/t0_0 1"
135
+
136
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
137
+ info("localhost", "t0_0_replicating", "ReplicatingShard")]
138
+
139
+ nameserver[:links].should == [link(id("localhost", "t0_0_replicating"), id("localhost", "t0_0"), 1)]
140
+ end
141
+ end
142
+
143
+ describe "unlink" do
144
+ it "unlinks two shards" do
145
+ gizzmo "create TestShard localhost/t0_0"
146
+ gizzmo "create ReplicatingShard localhost/t0_0_replicating"
147
+ gizzmo "addlink localhost/t0_0_replicating localhost/t0_0 1"
148
+ gizzmo "unlink localhost/t0_0_replicating localhost/t0_0"
149
+
150
+ nameserver[:shards].should == [info("localhost", "t0_0", "TestShard"),
151
+ info("localhost", "t0_0_replicating", "ReplicatingShard")]
152
+
153
+ nameserver[:links].should == []
154
+ end
155
+ end
156
+
157
+
158
+ describe "add-host" do
159
+ it "creates single and multiple hosts" do
160
+ gizzmo "add-host c1:c1host1:7777"
161
+ gizzmo "add-host c2:c2host1:7777 c2:c2host2:7777"
162
+
163
+ nameserver[:hosts].should == [ host("c1host1", 7777, "c1"),
164
+ host("c2host1", 7777, "c2"),
165
+ host("c2host2", 7777, "c2") ]
166
+ end
167
+ end
168
+
169
+ describe "remove-host" do
170
+ it "creates single and multiple hosts" do
171
+ gizzmo "add-host c1:c1host1:7777"
172
+ gizzmo "remove-host c1:c1host1:7777"
173
+
174
+ nameserver[:hosts].should == []
175
+ end
176
+ end
177
+ end
178
+
179
+ describe "basic read methods" do
180
+ before do
181
+ 3.times do |i|
182
+ gizzmo "create TestShard -s Int -d Int localhost/t0_#{i}_a 127.0.0.1/t0_#{i}_b"
183
+ gizzmo "create ReplicatingShard localhost/t0_#{i}_replicating"
184
+ gizzmo "addlink localhost/t0_#{i}_replicating localhost/t0_#{i}_a 1"
185
+ gizzmo "addlink localhost/t0_#{i}_replicating 127.0.0.1/t0_#{i}_b 1"
186
+ gizzmo "addforwarding 0 #{i} localhost/t0_#{i}_replicating"
187
+ end
188
+ end
189
+
190
+ describe "subtree" do
191
+ it "prints the tree for a shard" do
192
+ results = "localhost/t0_0_replicating\n 127.0.0.1/t0_0_b\n localhost/t0_0_a\n"
193
+ gizzmo("subtree localhost/t0_0_replicating").should == results
194
+ gizzmo("subtree localhost/t0_0_a").should == results
195
+ gizzmo("subtree 127.0.0.1/t0_0_b").should == results
196
+ end
197
+ end
198
+
199
+ describe "hosts" do
200
+ it "prints a list of unique hosts" do
201
+ gizzmo("hosts").should == "127.0.0.1\nlocalhost\n"
202
+ end
203
+ end
204
+
205
+ describe "forwardings" do
206
+ it "lists forwardings and the root of the corresponding shard trees" do
207
+ gizzmo("forwardings").should == <<-EOF
208
+ 0\t0\tlocalhost/t0_0_replicating
209
+ 0\t1\tlocalhost/t0_1_replicating
210
+ 0\t2\tlocalhost/t0_2_replicating
211
+ EOF
212
+ end
213
+ end
214
+
215
+ describe "links" do
216
+ it "lists links associated withe the given shards" do
217
+ gizzmo("links localhost/t0_0_a localhost/t0_1_a").should == <<-EOF
218
+ localhost/t0_0_replicating\tlocalhost/t0_0_a\t1
219
+ localhost/t0_1_replicating\tlocalhost/t0_1_a\t1
220
+ EOF
221
+ end
222
+ end
223
+
224
+ describe "info" do
225
+ it "outputs shard info for the given shard ids" do
226
+ gizzmo("info localhost/t0_0_a 127.0.0.1/t0_1_b localhost/t0_2_replicating").should == <<-EOF
227
+ localhost/t0_0_a\tTestShard\tok
228
+ 127.0.0.1/t0_1_b\tTestShard\tok
229
+ localhost/t0_2_replicating\tReplicatingShard\tok
230
+ EOF
231
+ end
232
+ end
233
+
234
+ describe "busy" do
235
+ it "lists all busy shards" do
236
+ gizzmo "markbusy localhost/t0_0_a localhost/t0_1_a localhost/t0_2_a"
237
+
238
+ gizzmo("busy").should == <<-EOF
239
+ localhost/t0_0_a\tTestShard\tbusy
240
+ localhost/t0_1_a\tTestShard\tbusy
241
+ localhost/t0_2_a\tTestShard\tbusy
242
+ EOF
243
+ end
244
+ end
245
+
246
+ describe "list-hosts" do
247
+ it "returns a list of all hosts and their status" do
248
+ gizzmo("add-host c1:c1host1:7777 c2:c2host1:7777 c2:c2host2:7777")
249
+
250
+ gizzmo("list-hosts").should == <<-EOF
251
+ c1:c1host1:7777 0
252
+ c2:c2host1:7777 0
253
+ c2:c2host2:7777 0
254
+ EOF
255
+ end
256
+ end
257
+
258
+ describe "topology" do
259
+ it "lists counts for each template" do
260
+ gizzmo("-T 0 topology").should == <<-EOF
261
+ 3 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
262
+ EOF
263
+ end
264
+
265
+ it "shows the template for each forwarding" do
266
+ gizzmo("-T 0 topology --forwardings").should == <<-EOF
267
+ 0 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
268
+ 1 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
269
+ 2 ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1,Int,Int))
270
+ EOF
271
+ end
272
+ end
273
+ end
274
+
275
+ describe "find" do
276
+ it "works"
277
+ end
278
+
279
+ describe "rebalance" do
280
+ it "works"
281
+ end
282
+
283
+ describe "repair" do
284
+ it "works"
285
+ end
286
+
287
+ describe "reload" do
288
+ it "works"
289
+ end
290
+
291
+ describe "drill" do
292
+ it "works"
293
+ end
294
+
295
+ describe "pair" do
296
+ it "works"
297
+ end
298
+
299
+ describe "report" do
300
+ it "works"
301
+ end
302
+
303
+ describe "lookup" do
304
+ it "works"
305
+ end
306
+
307
+ describe "copy" do
308
+ it "works"
309
+ end
310
+
311
+ describe "setup-migrate" do
312
+ it "works"
313
+ end
314
+
315
+ describe "finish-migrate" do
316
+ it "works"
317
+ end
318
+
319
+ describe "inject" do
320
+ it "works"
321
+ end
322
+
323
+ describe "flush" do
324
+ it "works"
325
+ end
326
+
327
+ describe "transform-tree" do
328
+ it "works" do
329
+ gizzmo "create -s Int -d Int TestShard localhost/s_0_001_a"
330
+ #gizzmo "create TestShard 127.0.0.1/s_0_001_b"
331
+ gizzmo "create ReplicatingShard localhost/s_0_001_replicating"
332
+ gizzmo "addlink localhost/s_0_001_replicating localhost/s_0_001_a 1"
333
+ #gizzmo "addlink localhost/s_0_001_replicating 127.0.0.1/s_0_001_b 1"
334
+ gizzmo "addforwarding 0 1 localhost/s_0_001_replicating"
335
+ gizzmo "-f reload"
336
+
337
+ 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
338
+ ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
339
+ PREPARE
340
+ create_shard(TestShard/127.0.0.1)
341
+ create_shard(WriteOnlyShard)
342
+ add_link(WriteOnlyShard -> TestShard/127.0.0.1)
343
+ add_link(ReplicatingShard -> WriteOnlyShard)
344
+ COPY
345
+ copy_shard(TestShard/127.0.0.1)
346
+ CLEANUP
347
+ add_link(ReplicatingShard -> TestShard/127.0.0.1)
348
+ remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
349
+ remove_link(ReplicatingShard -> WriteOnlyShard)
350
+ delete_shard(WriteOnlyShard)
351
+
352
+ STARTING:
353
+ [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))
354
+ COPIES:
355
+ localhost/s_0_001_a -> 127.0.0.1/s_0_0001
356
+ FINISHING:
357
+ [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))
358
+ 1 transformation applied. Total time elapsed: 1 second
359
+ EOF
360
+
361
+ nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
362
+ info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
363
+ info("localhost", "s_0_001_replicating", "ReplicatingShard") ]
364
+
365
+ nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
366
+ link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1) ]
367
+ end
368
+ end
369
+
370
+ describe "transform" do
371
+ it "works" do
372
+ 1.upto(2) do |i|
373
+ gizzmo "create TestShard -s Int -d Int localhost/s_0_00#{i}_a"
374
+ #gizzmo "create TestShard -s Int -d Int 127.0.0.1/s_0_000#{i}_b"
375
+ gizzmo "create ReplicatingShard localhost/s_0_00#{i}_replicating"
376
+ gizzmo "addlink localhost/s_0_00#{i}_replicating localhost/s_0_00#{i}_a 1"
377
+ #gizzmo "addlink localhost/s_0_00#{i}_replicating 127.0.0.1/s_0_000#{i}_b 1"
378
+ gizzmo "addforwarding 0 #{i} localhost/s_0_00#{i}_replicating"
379
+ end
380
+ gizzmo "-f reload"
381
+
382
+ 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
383
+ ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
384
+ PREPARE
385
+ create_shard(TestShard/127.0.0.1)
386
+ create_shard(WriteOnlyShard)
387
+ add_link(WriteOnlyShard -> TestShard/127.0.0.1)
388
+ add_link(ReplicatingShard -> WriteOnlyShard)
389
+ COPY
390
+ copy_shard(TestShard/127.0.0.1)
391
+ CLEANUP
392
+ add_link(ReplicatingShard -> TestShard/127.0.0.1)
393
+ remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
394
+ remove_link(ReplicatingShard -> WriteOnlyShard)
395
+ delete_shard(WriteOnlyShard)
396
+ Applied to 2 shards:
397
+ [0] 1 = localhost/s_0_001_replicating
398
+ [0] 2 = localhost/s_0_002_replicating
399
+
400
+ STARTING:
401
+ [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))
402
+ [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))
403
+ COPIES:
404
+ localhost/s_0_001_a -> 127.0.0.1/s_0_0001
405
+ localhost/s_0_002_a -> 127.0.0.1/s_0_0002
406
+ FINISHING:
407
+ [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))
408
+ [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))
409
+ 2 transformations applied. Total time elapsed: 1 second
410
+ EOF
411
+
412
+ nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
413
+ info("127.0.0.1", "s_0_0002", "TestShard"),
414
+ info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
415
+ info("localhost", "s_0_001_replicating", "ReplicatingShard"),
416
+ info("localhost", "s_0_002_a", "TestShard", "Int", "Int"),
417
+ info("localhost", "s_0_002_replicating", "ReplicatingShard") ]
418
+
419
+ nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
420
+ link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1),
421
+ link(id("localhost", "s_0_002_replicating"), id("127.0.0.1", "s_0_0002"), 1),
422
+ link(id("localhost", "s_0_002_replicating"), id("localhost", "s_0_002_a"), 1) ]
423
+ end
424
+
425
+ it "works with multiple forwarding tables" do
426
+ 0.upto(1) do |table|
427
+ 1.upto(2) do |i|
428
+ gizzmo "create TestShard -s Int -d Int localhost/s_#{table}_00#{i}_a"
429
+ #gizzmo "create TestShard -s Int -d Int 127.0.0.1/s_#{table}_000#{i}_b"
430
+ gizzmo "create ReplicatingShard localhost/s_#{table}_00#{i}_replicating"
431
+ gizzmo "addlink localhost/s_#{table}_00#{i}_replicating localhost/s_#{table}_00#{i}_a 1"
432
+ #gizzmo "addlink localhost/s_#{table}_00#{i}_replicating 127.0.0.1/s_#{table}_000#{i}_b 1"
433
+ gizzmo "addforwarding #{table} #{i} localhost/s_#{table}_00#{i}_replicating"
434
+ end
435
+ end
436
+ gizzmo "-f reload"
437
+
438
+ 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
439
+ ReplicatingShard(1) -> TestShard(localhost,1,Int,Int) => ReplicatingShard(1) -> (TestShard(localhost,1,Int,Int), TestShard(127.0.0.1,1)) :
440
+ PREPARE
441
+ create_shard(TestShard/127.0.0.1)
442
+ create_shard(WriteOnlyShard)
443
+ add_link(WriteOnlyShard -> TestShard/127.0.0.1)
444
+ add_link(ReplicatingShard -> WriteOnlyShard)
445
+ COPY
446
+ copy_shard(TestShard/127.0.0.1)
447
+ CLEANUP
448
+ add_link(ReplicatingShard -> TestShard/127.0.0.1)
449
+ remove_link(WriteOnlyShard -> TestShard/127.0.0.1)
450
+ remove_link(ReplicatingShard -> WriteOnlyShard)
451
+ delete_shard(WriteOnlyShard)
452
+ Applied to 4 shards:
453
+ [0] 1 = localhost/s_0_001_replicating
454
+ [0] 2 = localhost/s_0_002_replicating
455
+ [1] 1 = localhost/s_1_001_replicating
456
+ [1] 2 = localhost/s_1_002_replicating
457
+
458
+ STARTING:
459
+ [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))
460
+ [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))
461
+ [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))
462
+ [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))
463
+ COPIES:
464
+ localhost/s_0_001_a -> 127.0.0.1/s_0_0001
465
+ localhost/s_0_002_a -> 127.0.0.1/s_0_0002
466
+ localhost/s_1_001_a -> 127.0.0.1/s_1_0001
467
+ localhost/s_1_002_a -> 127.0.0.1/s_1_0002
468
+ FINISHING:
469
+ [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))
470
+ [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))
471
+ [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))
472
+ [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))
473
+ 4 transformations applied. Total time elapsed: 1 second
474
+ EOF
475
+
476
+ nameserver[:shards].should == [ info("127.0.0.1", "s_0_0001", "TestShard"),
477
+ info("127.0.0.1", "s_0_0002", "TestShard"),
478
+ info("127.0.0.1", "s_1_0001", "TestShard"),
479
+ info("127.0.0.1", "s_1_0002", "TestShard"),
480
+ info("localhost", "s_0_001_a", "TestShard", "Int", "Int"),
481
+ info("localhost", "s_0_001_replicating", "ReplicatingShard"),
482
+ info("localhost", "s_0_002_a", "TestShard", "Int", "Int"),
483
+ info("localhost", "s_0_002_replicating", "ReplicatingShard"),
484
+ info("localhost", "s_1_001_a", "TestShard", "Int", "Int"),
485
+ info("localhost", "s_1_001_replicating", "ReplicatingShard"),
486
+ info("localhost", "s_1_002_a", "TestShard", "Int", "Int"),
487
+ info("localhost", "s_1_002_replicating", "ReplicatingShard") ]
488
+
489
+ nameserver[:links].should == [ link(id("localhost", "s_0_001_replicating"), id("127.0.0.1", "s_0_0001"), 1),
490
+ link(id("localhost", "s_0_001_replicating"), id("localhost", "s_0_001_a"), 1),
491
+ link(id("localhost", "s_0_002_replicating"), id("127.0.0.1", "s_0_0002"), 1),
492
+ link(id("localhost", "s_0_002_replicating"), id("localhost", "s_0_002_a"), 1),
493
+ link(id("localhost", "s_1_001_replicating"), id("127.0.0.1", "s_1_0001"), 1),
494
+ link(id("localhost", "s_1_001_replicating"), id("localhost", "s_1_001_a"), 1),
495
+ link(id("localhost", "s_1_002_replicating"), id("127.0.0.1", "s_1_0002"), 1),
496
+ link(id("localhost", "s_1_002_replicating"), id("localhost", "s_1_002_a"), 1) ]
497
+ end
498
+ end
499
+ end