-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathcommands_test.rb
603 lines (541 loc) · 23.1 KB
/
commands_test.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
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
#
# Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.
require 'commands'
require 'test/unit'
module Commands
class MockExecutor
def exec(cmd)
end
end
class MockEMRClient
attr_accessor :state
def initialize(config)
@config = config
@state = "RUNNING"
@step_map =
{ "j-hive-installed" =>
{"ExecutionStatusDetail"=>
{"StartDateTime"=>1291074747.0, "EndDateTime"=>1291074776.0, "LastStateChangeReason"=>nil,
"CreationDateTime"=>1291074521.0, "State"=>"COMPLETED"},
"StepConfig"=>
{"Name"=>"Setup Hive",
"HadoopJarStep"=>
{"Jar"=>"s3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar",
"Args"=>
["s3://us-east-1.elasticmapreduce/libs/hive/hive-script",
"--base-path", "s3://us-east-1.elasticmapreduce/libs/hive/",
"--install-hive"],
"Properties"=>[],
"MainClass"=>nil},
"ActionOnFailure"=>"CONTINUE"}},
"j-hive-0.5-installed" =>
{"ExecutionStatusDetail"=>
{"StartDateTime"=>1291074747.0, "EndDateTime"=>1291074776.0, "LastStateChangeReason"=>nil,
"CreationDateTime"=>1291074521.0, "State"=>"COMPLETED"},
"StepConfig"=>
{"Name"=>"Setup Hive",
"HadoopJarStep"=>
{"Jar"=>"s3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar",
"Args"=>
["s3://us-east-1.elasticmapreduce/libs/hive/hive-script",
"--base-path", "s3://us-east-1.elasticmapreduce/libs/hive/",
"--install-hive","--hive-versions","0.5"],
"Properties"=>[],
"MainClass"=>nil},
"ActionOnFailure"=>"CONTINUE"}},
"j-hive-0.7-installed" =>
{"ExecutionStatusDetail"=>
{"StartDateTime"=>1291074747.0, "EndDateTime"=>1291074776.0, "LastStateChangeReason"=>nil,
"CreationDateTime"=>1291074521.0, "State"=>"COMPLETED"},
"StepConfig"=>
{"Name"=>"Setup Hive",
"HadoopJarStep"=>
{"Jar"=>"s3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar",
"Args"=>
["s3://us-east-1.elasticmapreduce/libs/hive/hive-script",
"--base-path", "s3://us-east-1.elasticmapreduce/libs/hive/",
"--install-hive","--hive-versions","0.7"],
"Properties"=>[],
"MainClass"=>nil},
"ActionOnFailure"=>"CONTINUE"}},
}
end
def self.new_aws_query(config)
return MockEMRClient.new(config)
end
def DescribeJobFlows(args)
steps = []
if args["JobFlowIds"] != nil and @step_map.has_key? args["JobFlowIds"].first then
steps = [@step_map[args["JobFlowIds"].first]]
end
return {
"JobFlows" =>
[
{
"LogUri" => "s3n://testing/",
"Name" => "Development Job Flow (requires manual termination)",
"BootstrapActions" =>[],
"ExecutionStatusDetail" => {
"EndDateTime" => 1286584312.0,
"CreationDateTime" => 1286584224.0,
"LastStateChangeReason" => "Terminated by user request",
"State" => @state,
"StartDateTime" => nil,
"ReadyDateTime" => nil
},
"Steps" => steps,
"JobFlowId" => "j-2HWO50OUKNMHG",
"Instances" => {
"Ec2KeyName" => "richcole-test",
"InstanceCount" =>5,
"NormalizedInstanceHours" => nil,
"Placement" => {"AvailabilityZone" => "us-east-1d"},
"KeepJobFlowAliveWhenNoSteps" => true,
"SlaveInstanceType" => "m2.xlarge",
"MasterInstanceType" => "m2.xlarge",
"MasterPublicDnsName" => nil,
"MasterInstanceId" => nil,
"InstanceGroups" => [{
"SpotPrice" => nil,
"EndDateTime" => nil,
"Name" => "Task Instance Group",
"InstanceRole" => "TASK",
"CreationDateTime" => 1286862675.0,
"LaunchGroup" => nil,
"LastStateChangeReason" => "",
"InstanceGroupId" => "ig-D2NC23WFSOOU",
"State" => "RUNNING",
"Market" => "ON_DEMAND",
"InstanceType" => "c1.medium",
"StartDateTime" => 1286862907.0,
"InstanceRunningCount" => 2,
"ReadyDateTime" => 1286862907.0,
"InstanceRequestCount" => 2
},
{
"SpotPrice" => nil,
"EndDateTime" => nil,
"Name" => "Master Instance Group",
"InstanceRole" => "MASTER",
"CreationDateTime" => 1286862675.0,
"LaunchGroup" => nil,
"LastStateChangeReason" => "",
"InstanceGroupId" => "ig-1BFN7TCX7YE5Y",
"State" => "RUNNING",
"Market" => "ON_DEMAND",
"InstanceType" => "m1.small",
"StartDateTime" => 1286862866.0,
"InstanceRunningCount" => 1,
"ReadyDateTime" => 1286862906.0,
"InstanceRequestCount" => 1
},
{
"SpotPrice" => nil,
"EndDateTime" => nil,
"Name" => "Core Instance Group",
"InstanceRole" => "CORE",
"CreationDateTime" => 1286862675.0,
"LaunchGroup" => nil,
"LastStateChangeReason" => "Expanding cluster",
"InstanceGroupId" => "ig-2EUIGTIPDLTXW",
"State" => "RESIZING",
"Market" => "ON_DEMAND",
"InstanceType" => "m1.large",
"StartDateTime" => 1286862907.0,
"InstanceRunningCount" => 1,
"ReadyDateTime" => 1286862907.0,
"InstanceRequestCount" => 3
}]
},
"HadoopVersion" => "0.20"
}
]
}
end
def RunJobFlow(opts)
return { "JobFlowId" => "j-ABABABABA" }
end
def AddJobFlowSteps(opts)
return nil
end
def TerminateJobFlows(opts)
return nil
end
def ModifyInstanceGroups(opts)
return nil
end
def AddInstanceGroups(opts)
return nil
end
end
class MockLogger
def puts(msg)
end
def trace(msg)
end
end
class CommandTest < Test::Unit::TestCase
def setup
@client_class = MockEMRClient #FIXME: make this return always the same object
@logger = MockLogger.new
@executor = MockExecutor.new
end
def create_and_execute_commands(args)
return ::Commands.create_and_execute_commands(args.split(/\s+/), @client_class, @logger, @executor, false)
end
def test_modify_instance_group_command
args = "-c tests/credentials.json --modify-instance-group core --instance-count 10 --jobflow j-ABABABA"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.size)
c = @commands.last
assert(c.is_a?(ModifyInstanceGroupCommand))
assert_equal(10, c.instance_count)
assert_not_nil(c.instance_group_id)
assert_equal(nil, c.instance_type)
assert_equal("CORE", c.instance_role)
end
def test_one
args = "-c tests/credentials.json --create --alive --num-instances 10 " +
"--slave-instance-type m1.small --master-instance-type m1.large"
@commands = create_and_execute_commands(args)
end
def test_two
args = "-c tests/credentials.json --create --alive --num-instances 10 " +
"--slave-instance-type m1.small --master-instance-type m1.large " +
"--instance-group TASK --instance-type m1.small --instance-count 10 " +
"--bootstrap-action s3://elasticmapreduce/scripts/configure-hadoop " +
"--arg s3://mybucket/config/custom-site-config.xml "
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
end
def test_three
args = "-c tests/credentials.json --create --alive --num-instances 10 " +
"--slave-instance-type m1.small --master-instance-type m1.large " +
"--instance-group TASK --instance-type m1.small --instance-count 10 " +
"--bootstrap-action s3://elasticmapreduce/scripts/configure-hadoop " +
"--arg s3://mybucket/config/custom-site-config.xml " +
"--pig-script s3://elasticmapreduce/samples/sample.pig " +
"--pig-interactive"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
cmd1 = @commands.commands.first
assert_equal(2, cmd1.step_commands.size)
assert_equal(PigInteractiveCommand, cmd1.step_commands[0].class)
end
def test_four
args = "-a ACCESS_ID -p SECRET_KEY --create --alive " +
"--hive-script s3://maps.google.com --enable-debugging " +
"--log-uri s3://somewhere.com/logs/"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
assert_equal(3, @commands.commands[0].step_commands.size)
steps = @commands.commands[0].step_commands
assert_equal(EnableDebuggingCommand, steps[0].class)
assert_equal(HiveInteractiveCommand, steps[1].class)
assert_equal(HiveScriptCommand, steps[2].class)
end
def hadoop_jar_step_args(command)
command.steps[0]["HadoopJarStep"]["Args"]
end
def pig_script_command_default_args
[
"s3://us-east-1.elasticmapreduce/libs/pig/pig-script",
"--base-path",
"s3://us-east-1.elasticmapreduce/libs/pig/",
"--run-pig-script",
"--args",
"-f"
]
end
def hive_script_command_default_args
[
"s3://us-east-1.elasticmapreduce/libs/hive/hive-script",
"--base-path",
"s3://us-east-1.elasticmapreduce/libs/hive/",
"--run-hive-script",
"--args",
"-f"
]
end
def test_pig_arg
args1 = "-a ACCESS_ID -p SECRET_KEY --create --alive " +
"--pig-script --args s3://maps.google.com --args -p,INPUT=s3://maps.google.com/test.pig"
args2 = "-a ACCESS_ID -p SECRET_KEY --create --alive " +
"--pig-script s3://maps.google.com --args -p,INPUT=s3://maps.google.com/test.pig"
@commands = create_and_execute_commands(args1)
steps = @commands.commands.first.step_commands
pig_command = steps[1]
assert_equal(pig_command.arg, nil)
assert_equal(pig_command.args, ["s3://maps.google.com", "-p", "INPUT=s3://maps.google.com/test.pig"])
assert_equal(pig_command.steps.size, 1)
args = pig_script_command_default_args
args << "s3://maps.google.com" << "-p" << "INPUT=s3://maps.google.com/test.pig"
assert_equal(hadoop_jar_step_args(pig_command), args)
@commands = create_and_execute_commands(args2)
steps = @commands.commands.first.step_commands
pig_command = steps[1]
assert_equal(pig_command.arg, "s3://maps.google.com")
assert_equal(pig_command.args, ["-p", "INPUT=s3://maps.google.com/test.pig"])
assert_equal(pig_command.steps.size, 1)
assert_equal(hadoop_jar_step_args(pig_command), args)
end
def test_hive
args = "-a ACCESS_ID -p SECRET_KEY --create --alive " +
"--hive-script --args s3://maps.google.com "
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[1]
assert_equal(1, @commands.commands.size)
assert_equal(2, steps.size)
assert_equal(HiveScriptCommand, hive_command.class)
assert_equal(hive_command.arg, nil)
assert_equal(hive_command.args, ["s3://maps.google.com"])
assert_equal(hive_command.steps.size, 1)
args = hive_script_command_default_args
args << "s3://maps.google.com"
assert_equal(hadoop_jar_step_args(hive_command), args)
end
def test_install_hive_version
args = "-a ACCESS_ID -p SECRET_KEY --create --alive " +
"--hive-script --args s3://maps.google.com --hive-versions 0.5"
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[1]
assert_equal(1, @commands.commands.size)
assert_equal(2, steps.size)
assert_equal(HiveScriptCommand, hive_command.class)
assert_equal(hive_command.arg, nil)
assert_equal(hive_command.args, ["s3://maps.google.com"])
assert_equal(hive_command.steps.size, 1)
args = hive_script_command_default_args
args.insert(3, "--hive-versions")
args.insert(4, "0.5")
args << "s3://maps.google.com"
assert_equal(hadoop_jar_step_args(hive_command), args)
end
def test_run_hive_script_same_version
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-hive-0.5-installed " +
"--hive-script --args s3://maps.google.com --hive-versions 0.5"
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[0]
assert_equal(1, @commands.commands.size)
assert_equal(1, steps.size)
assert_equal(HiveScriptCommand, hive_command.class)
assert_equal(hive_command.arg, nil)
assert_equal(hive_command.args, ["s3://maps.google.com"])
assert_equal(hive_command.steps.size, 1)
args = hive_script_command_default_args
args.insert(3, "--hive-versions")
args.insert(4, "0.5")
args << "s3://maps.google.com"
assert_equal(hadoop_jar_step_args(hive_command), args)
end
def test_run_hive_script_different_version
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-hive-0.5-installed " +
"--hive-script --args s3://maps.google.com --hive-versions 0.7"
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[1]
assert_equal(1, @commands.commands.size)
assert_equal(2, steps.size)
assert_equal(HiveScriptCommand, hive_command.class)
assert_equal(hive_command.arg, nil)
assert_equal(hive_command.args, ["s3://maps.google.com"])
assert_equal(hive_command.steps.size, 1)
args = hive_script_command_default_args
args.insert(3, "--hive-versions")
args.insert(4, "0.7")
args << "s3://maps.google.com"
assert_equal(hadoop_jar_step_args(hive_command), args)
end
def test_hive_script_step_action_propogation
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-hive-0.5-installed " +
"--hive-script --args s3://maps.google.com --hive-versions 0.7 " +
"--step-action CONTINUE"
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[0]
assert_equal(1, @commands.commands.size)
assert_equal(2, steps.size)
assert_equal(HiveInteractiveCommand, hive_command.class)
assert_equal(hive_command.arg, nil)
assert_equal(hive_command.args, [])
assert_equal(hive_command.steps.size, 1)
assert_equal(hive_command.steps.first["ActionOnFailure"], "CONTINUE")
end
def test_hive_no_create
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-ABABABABA " +
"--hive-script --args s3://maps.google.com "
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[1]
assert_equal(1, @commands.commands.size)
assert_equal(2, steps.size)
assert_equal(HiveScriptCommand, hive_command.class)
assert_equal(hive_command.arg, nil)
assert_equal(hive_command.args, ["s3://maps.google.com"])
assert_equal(hive_command.steps.size, 1)
args = hive_script_command_default_args
args << "s3://maps.google.com"
assert_equal(hadoop_jar_step_args(hive_command), args)
end
def test_hive_no_create2
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-ABABABABA " +
"--hive-script s3://maps.google.com --args -d,options "
@commands = create_and_execute_commands(args)
create_command = @commands.commands.first
steps = create_command.step_commands
install_hive_command = steps[0]
hive_command = steps[1]
assert_equal(1, @commands.commands.size)
assert_equal(2, steps.size)
assert_equal(HiveScriptCommand, hive_command.class)
assert_equal(hive_command.arg, "s3://maps.google.com")
assert_equal(hive_command.args, ["-d", "options"])
assert_equal(hive_command.steps.size, 1)
args = hive_script_command_default_args
args << "s3://maps.google.com" << "-d" << "options"
assert_equal(hadoop_jar_step_args(hive_command), args)
end
def test_five
args = "-a ACCESS_ID -p SECRET_KEY -j j-ABABABAABA --hive-script " +
"s3://maps.google.com --enable-debugging --log-uri s3://somewhere.com/logs/"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
assert_equal(3, @commands.commands[0].step_commands.size)
steps = @commands.commands[0].step_commands
assert_equal(EnableDebuggingCommand, steps[0].class)
assert_equal(HiveInteractiveCommand, steps[1].class)
assert_equal(HiveScriptCommand, steps[2].class)
end
def test_six
args = "-a ACCESS_ID -p SECRET_KEY --list --active"
@commands = create_and_execute_commands(args)
end
def test_seven
args = "-a ACCESS_ID -p SECRET_KEY --list --active --terminate"
@commands = create_and_execute_commands(args)
end
def test_eight
args = "-a ACCESS_ID -p SECRET_KEY --terminate -j j-ABABABABA"
@commands = create_and_execute_commands(args)
end
def test_create_one
args = "-a ACCESS_ID -p SECRET_KEY --create --alive --name TestFlow"
@commands = create_and_execute_commands(args)
end
def test_ssh_no_jobflow
args = "-a ACCESS_ID -p SECRET_KEY --ssh"
assert_raise RuntimeError do
@commands = create_and_execute_commands(args)
end
end
def test_ssh_too_many_jobflows
args = "-a ACCESS_ID -p SECRET_KEY -j j-ABABABA j-ABABABA --ssh"
assert_raise RuntimeError do
@commands = create_and_execute_commands(args)
end
end
def test_jar_with_mainclass
args = "-a ACCESS_ID -p SECRET_KEY -j j-3TRNB9E4GU2NI
--jar s3://my-example-bucket/wordcount.jar
--main-class org.myorg.WordCount
--arg s3://elasticmapreduce/samples/wordcount/input/
--arg hdfs:///wordcount/output/1
"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
c = @commands.commands.first
s = c.step_commands.first
st = s.steps
assert_equal([{"HadoopJarStep"=>{"Jar"=>"s3://my-example-bucket/wordcount.jar",
"Args"=>["s3://elasticmapreduce/samples/wordcount/input/", "hdfs:///wordcount/output/1"],
"MainClass"=>"org.myorg.WordCount"}, "ActionOnFailure"=>"CANCEL_AND_WAIT", "Name"=>"Example Jar Step"}], st)
end
def test_ssh
args = "-a ACCESS_ID -p SECRET_KEY --key-pair-file test.pem -j j-ABABABA --ssh"
@commands = create_and_execute_commands(args)
end
def test_unarrest
args = "-a ACCESS_ID -p SECRET_KEY --unarrest-instance-group core -j j-ABABABA"
@commands = create_and_execute_commands(args)
end
def test_late_name
args = "-a ACCESS_ID -p SECRET_KEY --create --alive --enable-debugging --hive-interactive --name MyHiveJobFlow --log-uri=s3://haijun-test/logs"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
assert_equal("MyHiveJobFlow", @commands.commands.first.jobflow_name)
end
def test_ic_it
args = "-a ACCESS_ID -p SECRET_KEY --create --alive --enable-debugging --hive-interactive --instance-count 5 --instance-type m1.small --name MyHiveJobFlow --log-uri=s3://haijun-test/logs"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
cc = @commands.commands.first
assert_equal("MyHiveJobFlow", cc.jobflow_name)
assert_equal(5, cc.instance_count)
assert_equal("m1.small", cc.instance_type)
end
def test_json
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-ABABABABA --json tests/example.json --param <bucket>=mybucket --param mybucket=yourbucket"
@commands = create_and_execute_commands(args)
assert_equal(1, @commands.commands.size)
cc = @commands.commands.first.step_commands.first
assert_equal("tests/example.json", cc.arg)
assert_equal({:key => "<bucket>", :value => "mybucket"}, cc.variables[0])
assert_equal({:key => "mybucket", :value => "yourbucket"}, cc.variables[1])
st = cc.steps.first
expected_step = {
"HadoopJarStep" => {
"Jar" => "/home/hadoop/contrib/streaming/hadoop-0.18-streaming.jar",
"Args" => ["-input", "s3n://elasticmapreduce/samples/wordcount/input",
"-output", "s3n://yourbucket/result", "-mapper", "s3://yourbucket/lib/mapper"]
},
"ActionOnFailure" => "CONTINUE",
"Name" => "Example Step"
}
assert_equal(expected_step, st)
end
def test_ic_it2
args = "-a ACCESS_ID -p SECRET_KEY --jobflow j-ABABABAB --resize-jobflow --add-instance-group task --instance-type m1.large --instance-count 5"
@commands = create_and_execute_commands(args)
assert_equal(2, @commands.commands.size)
cc = @commands.commands[1]
assert_equal(5, cc.instance_count)
assert_equal("m1.large", cc.instance_type)
assert_equal("TASK", cc.instance_role)
end
def test_command_option_mismatch
args = "-c tests/credentials.json --instance-group core --instance-count 10"
assert_raise RuntimeError do
@commands = create_and_execute_commands(args)
end
end
def test_region_from_az
@commands = create_and_execute_commands("-c tests/credentials.json")
eip_command = EipCommand.new("eip-command", "eip-command", "arg", @commands)
assert_equal('https://ec2.us-east-1.amazonaws.com', eip_command.ec2_endpoint_from_az('us-east-1a'))
assert_equal('https://ec2.ap-northeast-1.amazonaws.com', eip_command.ec2_endpoint_from_az('ec2.ap-northeast-1b'))
assert_equal('https://ec2.us-west-1.amazonaws.com', eip_command.ec2_endpoint_from_az('ec2.us-west-1b'))
assert_equal('https://ec2.us-west-2.amazonaws.com', eip_command.ec2_endpoint_from_az('ec2.us-west-2b'))
assert_equal('https://ec2.sa-east-1.amazonaws.com', eip_command.ec2_endpoint_from_az('ec2.sa-east-1b'))
end
def test_hbase_instance_types
assert_raise RuntimeError do
@commands = create_and_execute_commands("-c tests/credentials.json --create --hbase")
end
end
end
end