vmfloaty 1.2.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,13 +36,14 @@ describe Utils do
36
36
 
37
37
  it 'formats a result from vmpooler into a hash of os to hostnames' do
38
38
  result = Utils.standardize_hostnames(JSON.parse(@vmpooler_response_body))
39
- expect(result).to eq('centos-7-x86_64' => ['dlgietfmgeegry2.delivery.mycompany.net'],
40
- 'ubuntu-1610-x86_64' => ['gdoy8q3nckuob0i.delivery.mycompany.net', 'ctnktsd0u11p9tm.delivery.mycompany.net'])
39
+ expect(result).to eq('centos-7-x86_64' => ['dlgietfmgeegry2.delivery.mycompany.net'],
40
+ 'ubuntu-1610-x86_64' => ['gdoy8q3nckuob0i.delivery.mycompany.net',
41
+ 'ctnktsd0u11p9tm.delivery.mycompany.net'])
41
42
  end
42
43
 
43
44
  it 'formats a result from the nonstandard pooler into a hash of os to hostnames' do
44
45
  result = Utils.standardize_hostnames(JSON.parse(@nonstandard_response_body))
45
- expect(result).to eq('solaris-10-sparc' => ['sol10-10.delivery.mycompany.net', 'sol10-11.delivery.mycompany.net'],
46
+ expect(result).to eq('solaris-10-sparc' => ['sol10-10.delivery.mycompany.net', 'sol10-11.delivery.mycompany.net'],
46
47
  'ubuntu-16.04-power8' => ['power8-ubuntu16.04-6.delivery.mycompany.net'])
47
48
  end
48
49
  end
@@ -50,12 +51,12 @@ describe Utils do
50
51
  describe '#format_host_output' do
51
52
  before :each do
52
53
  @vmpooler_results = {
53
- 'centos-7-x86_64' => ['dlgietfmgeegry2.delivery.mycompany.net'],
54
- 'ubuntu-1610-x86_64' => ['gdoy8q3nckuob0i.delivery.mycompany.net', 'ctnktsd0u11p9tm.delivery.mycompany.net'],
54
+ 'centos-7-x86_64' => ['dlgietfmgeegry2.delivery.mycompany.net'],
55
+ 'ubuntu-1610-x86_64' => ['gdoy8q3nckuob0i.delivery.mycompany.net', 'ctnktsd0u11p9tm.delivery.mycompany.net']
55
56
  }
56
57
  @nonstandard_results = {
57
- 'solaris-10-sparc' => ['sol10-10.delivery.mycompany.net', 'sol10-11.delivery.mycompany.net'],
58
- 'ubuntu-16.04-power8' => ['power8-ubuntu16.04-6.delivery.mycompany.net'],
58
+ 'solaris-10-sparc' => ['sol10-10.delivery.mycompany.net', 'sol10-11.delivery.mycompany.net'],
59
+ 'ubuntu-16.04-power8' => ['power8-ubuntu16.04-6.delivery.mycompany.net']
59
60
  }
60
61
  @vmpooler_output = <<~OUT.chomp
61
62
  - dlgietfmgeegry2.delivery.mycompany.net (centos-7-x86_64)
@@ -98,23 +99,23 @@ describe Utils do
98
99
  describe '#get_service_config' do
99
100
  before :each do
100
101
  @default_config = {
101
- 'url' => 'http://default.url',
102
- 'user' => 'first.last.default',
103
- 'token' => 'default-token',
102
+ 'url' => 'http://default.url',
103
+ 'user' => 'first.last.default',
104
+ 'token' => 'default-token'
104
105
  }
105
106
  @services_config = {
106
107
  'services' => {
107
108
  'vm' => {
108
- 'url' => 'http://vmpooler.url',
109
- 'user' => 'first.last.vmpooler',
110
- 'token' => 'vmpooler-token',
109
+ 'url' => 'http://vmpooler.url',
110
+ 'user' => 'first.last.vmpooler',
111
+ 'token' => 'vmpooler-token'
111
112
  },
112
113
  'ns' => {
113
- 'url' => 'http://nspooler.url',
114
- 'user' => 'first.last.nspooler',
115
- 'token' => 'nspooler-token',
116
- },
117
- },
114
+ 'url' => 'http://nspooler.url',
115
+ 'user' => 'first.last.nspooler',
116
+ 'token' => 'nspooler-token'
117
+ }
118
+ }
118
119
  }
119
120
  end
120
121
 
@@ -126,26 +127,26 @@ describe Utils do
126
127
 
127
128
  it 'allows selection by configured service key' do
128
129
  config = @default_config.merge @services_config
129
- options = MockOptions.new(:service => 'ns')
130
+ options = MockOptions.new(service: 'ns')
130
131
  expect(Utils.get_service_config(config, options)).to include @services_config['services']['ns']
131
132
  end
132
133
 
133
134
  it 'uses top-level service config values as defaults when configured service values are missing' do
134
135
  config = @default_config.merge @services_config
135
136
  config['services']['vm'].delete 'url'
136
- options = MockOptions.new(:service => 'vm')
137
+ options = MockOptions.new(service: 'vm')
137
138
  expect(Utils.get_service_config(config, options)['url']).to eq 'http://default.url'
138
139
  end
139
140
 
140
141
  it "raises an error if passed a service name that hasn't been configured" do
141
142
  config = @default_config.merge @services_config
142
- options = MockOptions.new(:service => 'none')
143
+ options = MockOptions.new(service: 'none')
143
144
  expect { Utils.get_service_config(config, options) }.to raise_error ArgumentError
144
145
  end
145
146
 
146
147
  it 'prioritizes values passed as command line options over configuration options' do
147
148
  config = @default_config
148
- options = MockOptions.new(:url => 'http://alternate.url', :token => 'alternate-token')
149
+ options = MockOptions.new(url: 'http://alternate.url', token: 'alternate-token')
149
150
  expected = config.merge('url' => 'http://alternate.url', 'token' => 'alternate-token')
150
151
  expect(Utils.get_service_config(config, options)).to include expected
151
152
  end
@@ -182,15 +183,15 @@ describe Utils do
182
183
  {
183
184
  'template' => 'ubuntu-1604-x86_64',
184
185
  'lifetime' => 12,
185
- 'running' => 9.66,
186
- 'state' => 'running',
187
- 'ip' => '127.0.0.1',
188
- 'domain' => domain,
186
+ 'running' => 9.66,
187
+ 'state' => 'running',
188
+ 'ip' => '127.0.0.1',
189
+ 'domain' => domain
189
190
  }
190
191
  end
191
192
 
192
193
  it 'outputs fqdn for host' do
193
- expect(STDOUT).to receive(:puts).with(fqdn)
194
+ expect($stdout).to receive(:puts).with(fqdn)
194
195
 
195
196
  subject
196
197
  end
@@ -201,17 +202,17 @@ describe Utils do
201
202
  let(:hostname) { 'sol11-9.delivery.mycompany.net' }
202
203
  let(:host_data) do
203
204
  {
204
- 'fqdn' => hostname,
205
- 'os_triple' => 'solaris-11-sparc',
206
- 'reserved_by_user' => 'first.last',
207
- 'reserved_for_reason' => '',
208
- 'hours_left_on_reservation' => 35.89,
205
+ 'fqdn' => hostname,
206
+ 'os_triple' => 'solaris-11-sparc',
207
+ 'reserved_by_user' => 'first.last',
208
+ 'reserved_for_reason' => '',
209
+ 'hours_left_on_reservation' => 35.89
209
210
  }
210
211
  end
211
212
  let(:fqdn) { hostname } # for nspooler these are the same
212
213
 
213
214
  it 'outputs fqdn for host' do
214
- expect(STDOUT).to receive(:puts).with(fqdn)
215
+ expect($stdout).to receive(:puts).with(fqdn)
215
216
 
216
217
  subject
217
218
  end
@@ -231,19 +232,19 @@ describe Utils do
231
232
  {
232
233
  'hostname' => fqdn,
233
234
  'type' => template,
234
- 'enging' => 'vmpooler',
235
- },
235
+ 'enging' => 'vmpooler'
236
+ }
236
237
  ],
237
238
  'request' => {
238
239
  'job' => {
239
- 'id' => hostname,
240
+ 'id' => hostname
240
241
  }
241
- },
242
+ }
242
243
  }
243
244
  end
244
245
 
245
246
  it 'outputs fqdn for host' do
246
- expect(STDOUT).to receive(:puts).with(fqdn)
247
+ expect($stdout).to receive(:puts).with(fqdn)
247
248
 
248
249
  subject
249
250
  end
@@ -275,18 +276,18 @@ describe Utils do
275
276
  hostname => {
276
277
  'template' => 'ubuntu-1604-x86_64',
277
278
  'lifetime' => 12,
278
- 'running' => 9.66,
279
- 'state' => 'running',
280
- 'ip' => '127.0.0.1',
281
- 'domain' => domain,
279
+ 'running' => 9.66,
280
+ 'state' => 'running',
281
+ 'ip' => '127.0.0.1',
282
+ 'domain' => domain
282
283
  }
283
284
  }
284
285
  end
285
286
 
286
- let(:default_output) { "- #{fqdn} (ubuntu-1604-x86_64, 9.66/12 hours)" }
287
+ let(:default_output) { "- #{fqdn} (running, ubuntu-1604-x86_64, 9.66/12 hours)" }
287
288
 
288
289
  it 'prints output with host fqdn, template and duration info' do
289
- expect(STDOUT).to receive(:puts).with(default_output)
290
+ expect($stdout).to receive(:puts).with(default_output)
290
291
 
291
292
  subject
292
293
  end
@@ -298,22 +299,22 @@ describe Utils do
298
299
  hostname => {
299
300
  'template' => 'redhat-7-x86_64',
300
301
  'lifetime' => 48,
301
- 'running' => 7.67,
302
- 'state' => 'running',
303
- 'tags' => {
302
+ 'running' => 7.67,
303
+ 'state' => 'running',
304
+ 'tags' => {
304
305
  'user' => 'bob',
305
- 'role' => 'agent',
306
+ 'role' => 'agent'
306
307
  },
307
- 'ip' => '127.0.0.1',
308
- 'domain' => domain,
308
+ 'ip' => '127.0.0.1',
309
+ 'domain' => domain
309
310
  }
310
311
  }
311
312
  end
312
313
 
313
314
  it 'prints output with host fqdn, template, duration info, and tags' do
314
- output = "- #{fqdn} (redhat-7-x86_64, 7.67/48 hours, user: bob, role: agent)"
315
+ output = "- #{fqdn} (running, redhat-7-x86_64, 7.67/48 hours, user: bob, role: agent)"
315
316
 
316
- expect(STDOUT).to receive(:puts).with(output)
317
+ expect($stdout).to receive(:puts).with(output)
317
318
 
318
319
  subject
319
320
  end
@@ -323,7 +324,7 @@ describe Utils do
323
324
  let(:print_to_stderr) { true }
324
325
 
325
326
  it 'outputs to stderr instead of stdout' do
326
- expect(STDERR).to receive(:puts).with(default_output)
327
+ expect($stderr).to receive(:puts).with(default_output)
327
328
 
328
329
  subject
329
330
  end
@@ -337,11 +338,11 @@ describe Utils do
337
338
  let(:response_body) do
338
339
  {
339
340
  hostname => {
340
- 'fqdn' => hostname,
341
- 'os_triple' => 'solaris-11-sparc',
342
- 'reserved_by_user' => 'first.last',
343
- 'reserved_for_reason' => '',
344
- 'hours_left_on_reservation' => 35.89,
341
+ 'fqdn' => hostname,
342
+ 'os_triple' => 'solaris-11-sparc',
343
+ 'reserved_by_user' => 'first.last',
344
+ 'reserved_for_reason' => '',
345
+ 'hours_left_on_reservation' => 35.89
345
346
  }
346
347
  }
347
348
  end
@@ -349,7 +350,7 @@ describe Utils do
349
350
  let(:default_output) { "- #{hostname} (solaris-11-sparc, 35.89h remaining)" }
350
351
 
351
352
  it 'prints output with host, template, and time remaining' do
352
- expect(STDOUT).to receive(:puts).with(default_output)
353
+ expect($stdout).to receive(:puts).with(default_output)
353
354
 
354
355
  subject
355
356
  end
@@ -358,11 +359,11 @@ describe Utils do
358
359
  let(:response_body) do
359
360
  {
360
361
  hostname => {
361
- 'fqdn' => hostname,
362
- 'os_triple' => 'solaris-11-sparc',
363
- 'reserved_by_user' => 'first.last',
364
- 'reserved_for_reason' => 'testing',
365
- 'hours_left_on_reservation' => 35.89,
362
+ 'fqdn' => hostname,
363
+ 'os_triple' => 'solaris-11-sparc',
364
+ 'reserved_by_user' => 'first.last',
365
+ 'reserved_for_reason' => 'testing',
366
+ 'hours_left_on_reservation' => 35.89
366
367
  }
367
368
  }
368
369
  end
@@ -370,7 +371,7 @@ describe Utils do
370
371
  it 'prints output with host, template, time remaining, and reason' do
371
372
  output = '- sol11-9.delivery.mycompany.net (solaris-11-sparc, 35.89h remaining, reason: testing)'
372
373
 
373
- expect(STDOUT).to receive(:puts).with(output)
374
+ expect($stdout).to receive(:puts).with(output)
374
375
 
375
376
  subject
376
377
  end
@@ -380,7 +381,7 @@ describe Utils do
380
381
  let(:print_to_stderr) { true }
381
382
 
382
383
  it 'outputs to stderr instead of stdout' do
383
- expect(STDERR).to receive(:puts).with(default_output)
384
+ expect($stderr).to receive(:puts).with(default_output)
384
385
 
385
386
  subject
386
387
  end
@@ -392,7 +393,7 @@ describe Utils do
392
393
 
393
394
  let(:hostname) { '1597952189390' }
394
395
  let(:fqdn) { 'example-noun.delivery.mycompany.net' }
395
- let(:fqdn_hostname) {'example-noun'}
396
+ let(:fqdn_hostname) { 'example-noun' }
396
397
  let(:template) { 'ubuntu-1604-x86_64' }
397
398
 
398
399
  # This seems to be the miminal stub response from ABS for the current output
@@ -404,14 +405,14 @@ describe Utils do
404
405
  {
405
406
  'hostname' => fqdn,
406
407
  'type' => template,
407
- 'engine' => 'vmpooler',
408
- },
408
+ 'engine' => 'vmpooler'
409
+ }
409
410
  ],
410
411
  'request' => {
411
412
  'job' => {
412
- 'id' => hostname,
413
+ 'id' => hostname
413
414
  }
414
- },
415
+ }
415
416
  }
416
417
  }
417
418
  end
@@ -420,47 +421,58 @@ describe Utils do
420
421
  let(:domain) { 'delivery.mycompany.net' }
421
422
  let(:response_body_vmpooler) do
422
423
  {
423
- fqdn_hostname => {
424
- 'template' => template,
425
- 'lifetime' => 48,
426
- 'running' => 7.67,
427
- 'state' => 'running',
428
- 'tags' => {
429
- 'user' => 'bob',
430
- 'role' => 'agent',
431
- },
432
- 'ip' => '127.0.0.1',
433
- 'domain' => domain,
434
- }
424
+ fqdn_hostname => {
425
+ 'template' => template,
426
+ 'lifetime' => 48,
427
+ 'running' => 7.67,
428
+ 'state' => 'running',
429
+ 'tags' => {
430
+ 'user' => 'bob',
431
+ 'role' => 'agent'
432
+ },
433
+ 'ip' => '127.0.0.1',
434
+ 'domain' => domain
435
+ }
435
436
  }
436
437
  end
437
438
 
438
439
  before(:each) do
439
440
  allow(Utils).to receive(:get_vmpooler_service_config).and_return({
440
- 'url' => 'http://vmpooler.example.com',
441
- 'token' => 'krypto-knight'
442
- })
441
+ 'url' => 'http://vmpooler.example.com',
442
+ 'token' => 'krypto-knight'
443
+ })
443
444
  allow(service).to receive(:query)
444
- .with(anything, fqdn_hostname)
445
- .and_return(response_body_vmpooler)
445
+ .with(anything, fqdn_hostname)
446
+ .and_return(response_body_vmpooler)
446
447
  end
447
448
 
448
449
  let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
449
450
  let(:default_output_second_line) { " - #{fqdn} (#{template})" }
450
451
 
451
452
  it 'prints output with job id, host, and template' do
452
- expect(STDOUT).to receive(:puts).with(default_output_first_line)
453
- expect(STDOUT).to receive(:puts).with(default_output_second_line)
453
+ expect($stdout).to receive(:puts).with(default_output_first_line)
454
+ expect($stdout).to receive(:puts).with(default_output_second_line)
454
455
 
455
456
  subject
456
457
  end
457
458
 
458
459
  it 'prints more information when vmpooler_fallback is set output with job id, host, template, lifetime, user and role' do
459
- fallback = {'vmpooler_fallback' => 'vmpooler'}
460
+ fallback = { 'vmpooler_fallback' => 'vmpooler' }
461
+ service.config.merge! fallback
462
+ default_output_second_line = " - #{fqdn} (running, #{template}, 7.67/48 hours, user: bob, role: agent)"
463
+ expect($stdout).to receive(:puts).with(default_output_first_line)
464
+ expect($stdout).to receive(:puts).with(default_output_second_line)
465
+
466
+ subject
467
+ end
468
+
469
+ it 'prints DESTROYED and hostname when destroyed' do
470
+ fallback = { 'vmpooler_fallback' => 'vmpooler' }
460
471
  service.config.merge! fallback
461
- default_output_second_line=" - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)"
462
- expect(STDOUT).to receive(:puts).with(default_output_first_line)
463
- expect(STDOUT).to receive(:puts).with(default_output_second_line)
472
+ response_body_vmpooler[fqdn_hostname]['state'] = 'destroyed'
473
+ default_output_second_line = " - DESTROYED #{fqdn}"
474
+ expect($stdout).to receive(:puts).with(default_output_first_line)
475
+ expect($stdout).to receive(:puts).with(default_output_second_line)
464
476
 
465
477
  subject
466
478
  end
@@ -469,8 +481,8 @@ describe Utils do
469
481
  let(:print_to_stderr) { true }
470
482
 
471
483
  it 'outputs to stderr instead of stdout' do
472
- expect(STDERR).to receive(:puts).with(default_output_first_line)
473
- expect(STDERR).to receive(:puts).with(default_output_second_line)
484
+ expect($stderr).to receive(:puts).with(default_output_first_line)
485
+ expect($stderr).to receive(:puts).with(default_output_second_line)
474
486
 
475
487
  subject
476
488
  end
@@ -483,34 +495,34 @@ describe Utils do
483
495
  let(:hostname) { '1597952189390' }
484
496
  let(:fqdn) { 'this-noun.delivery.mycompany.net' }
485
497
  let(:fqdn_ns) { 'that-noun.delivery.mycompany.net' }
486
- let(:fqdn_hostname) {'this-noun'}
487
- let(:fqdn_ns_hostname) {'that-noun'}
498
+ let(:fqdn_hostname) { 'this-noun' }
499
+ let(:fqdn_ns_hostname) { 'that-noun' }
488
500
  let(:template) { 'ubuntu-1604-x86_64' }
489
501
  let(:template_ns) { 'solaris-10-sparc' }
490
502
 
491
503
  # This seems to be the miminal stub response from ABS for the current output
492
504
  let(:response_body) do
493
505
  {
494
- hostname => {
495
- 'state' => 'allocated',
496
- 'allocated_resources' => [
497
- {
498
- 'hostname' => fqdn,
499
- 'type' => template,
500
- 'engine' => 'vmpooler',
501
- },
502
- {
503
- 'hostname' => fqdn_ns,
504
- 'type' => template_ns,
505
- 'engine' => 'nspooler',
506
- },
507
- ],
508
- 'request' => {
509
- 'job' => {
510
- 'id' => hostname,
511
- }
512
- },
506
+ hostname => {
507
+ 'state' => 'allocated',
508
+ 'allocated_resources' => [
509
+ {
510
+ 'hostname' => fqdn,
511
+ 'type' => template,
512
+ 'engine' => 'vmpooler'
513
+ },
514
+ {
515
+ 'hostname' => fqdn_ns,
516
+ 'type' => template_ns,
517
+ 'engine' => 'nspooler'
518
+ }
519
+ ],
520
+ 'request' => {
521
+ 'job' => {
522
+ 'id' => hostname
523
+ }
513
524
  }
525
+ }
514
526
  }
515
527
  end
516
528
 
@@ -518,29 +530,29 @@ describe Utils do
518
530
  let(:domain) { 'delivery.mycompany.net' }
519
531
  let(:response_body_vmpooler) do
520
532
  {
521
- fqdn_hostname => {
522
- 'template' => template,
523
- 'lifetime' => 48,
524
- 'running' => 7.67,
525
- 'state' => 'running',
526
- 'tags' => {
527
- 'user' => 'bob',
528
- 'role' => 'agent',
529
- },
530
- 'ip' => '127.0.0.1',
531
- 'domain' => domain,
532
- }
533
+ fqdn_hostname => {
534
+ 'template' => template,
535
+ 'lifetime' => 48,
536
+ 'running' => 7.67,
537
+ 'state' => 'running',
538
+ 'tags' => {
539
+ 'user' => 'bob',
540
+ 'role' => 'agent'
541
+ },
542
+ 'ip' => '127.0.0.1',
543
+ 'domain' => domain
544
+ }
533
545
  }
534
546
  end
535
547
 
536
548
  before(:each) do
537
549
  allow(Utils).to receive(:get_vmpooler_service_config).and_return({
538
- 'url' => 'http://vmpooler.example.com',
539
- 'token' => 'krypto-knight'
550
+ 'url' => 'http://vmpooler.example.com',
551
+ 'token' => 'krypto-knight'
540
552
  })
541
553
  allow(service).to receive(:query)
542
- .with(anything, fqdn_hostname)
543
- .and_return(response_body_vmpooler)
554
+ .with(anything, fqdn_hostname)
555
+ .and_return(response_body_vmpooler)
544
556
  end
545
557
 
546
558
  let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
@@ -548,9 +560,9 @@ describe Utils do
548
560
  let(:default_output_third_line) { " - #{fqdn_ns} (#{template_ns})" }
549
561
 
550
562
  it 'prints output with job id, host, and template' do
551
- expect(STDOUT).to receive(:puts).with(default_output_first_line)
552
- expect(STDOUT).to receive(:puts).with(default_output_second_line)
553
- expect(STDOUT).to receive(:puts).with(default_output_third_line)
563
+ expect($stdout).to receive(:puts).with(default_output_first_line)
564
+ expect($stdout).to receive(:puts).with(default_output_second_line)
565
+ expect($stdout).to receive(:puts).with(default_output_third_line)
554
566
 
555
567
  subject
556
568
  end
@@ -559,9 +571,9 @@ describe Utils do
559
571
  let(:print_to_stderr) { true }
560
572
 
561
573
  it 'outputs to stderr instead of stdout' do
562
- expect(STDERR).to receive(:puts).with(default_output_first_line)
563
- expect(STDERR).to receive(:puts).with(default_output_second_line)
564
- expect(STDERR).to receive(:puts).with(default_output_third_line)
574
+ expect($stderr).to receive(:puts).with(default_output_first_line)
575
+ expect($stderr).to receive(:puts).with(default_output_second_line)
576
+ expect($stderr).to receive(:puts).with(default_output_third_line)
565
577
 
566
578
  subject
567
579
  end
@@ -575,54 +587,59 @@ describe Utils do
575
587
  config = {
576
588
  'user' => 'foo',
577
589
  'services' => {
578
- 'myabs' => {
579
- 'url' => 'http://abs.com',
580
- 'token' => 'krypto-night',
581
- 'type' => 'abs'
582
- }
590
+ 'myabs' => {
591
+ 'url' => 'http://abs.com',
592
+ 'token' => 'krypto-night',
593
+ 'type' => 'abs'
594
+ }
583
595
  }
584
596
  }
585
597
  allow(Conf).to receive(:read_config).and_return(config)
586
- expect{Utils.get_vmpooler_service_config(config['services']['myabs']['vmpooler_fallback'])}.to raise_error(ArgumentError)
598
+ expect do
599
+ Utils.get_vmpooler_service_config(config['services']['myabs']['vmpooler_fallback'])
600
+ end.to raise_error(ArgumentError)
587
601
  end
588
602
  it 'returns an error if the vmpooler_fallback is setup but cannot be found' do
589
603
  config = {
590
604
  'user' => 'foo',
591
605
  'services' => {
592
606
  'myabs' => {
593
- 'url' => 'http://abs.com',
594
- 'token' => 'krypto-night',
595
- 'type' => 'abs',
596
- 'vmpooler_fallback' => 'myvmpooler'
607
+ 'url' => 'http://abs.com',
608
+ 'token' => 'krypto-night',
609
+ 'type' => 'abs',
610
+ 'vmpooler_fallback' => 'myvmpooler'
597
611
  }
598
612
  }
599
613
  }
600
614
  allow(Conf).to receive(:read_config).and_return(config)
601
- expect{Utils.get_vmpooler_service_config(config['services']['myabs']['vmpooler_fallback'])}.to raise_error(ArgumentError, /myvmpooler/)
615
+ expect do
616
+ Utils.get_vmpooler_service_config(config['services']['myabs']['vmpooler_fallback'])
617
+ end.to raise_error(ArgumentError,
618
+ /myvmpooler/)
602
619
  end
603
620
  it 'returns the vmpooler_fallback config' do
604
621
  config = {
605
622
  'user' => 'foo',
606
623
  'services' => {
607
624
  'myabs' => {
608
- 'url' => 'http://abs.com',
609
- 'token' => 'krypto-night',
610
- 'type' => 'abs',
611
- 'vmpooler_fallback' => 'myvmpooler'
625
+ 'url' => 'http://abs.com',
626
+ 'token' => 'krypto-night',
627
+ 'type' => 'abs',
628
+ 'vmpooler_fallback' => 'myvmpooler'
612
629
  },
613
630
  'myvmpooler' => {
614
- 'url' => 'http://vmpooler.com',
615
- 'token' => 'krypto-knight'
631
+ 'url' => 'http://vmpooler.com',
632
+ 'token' => 'krypto-knight'
616
633
  }
617
634
  }
618
635
  }
619
636
  allow(Conf).to receive(:read_config).and_return(config)
620
637
  expect(Utils.get_vmpooler_service_config(config['services']['myabs']['vmpooler_fallback'])).to include({
621
- 'url' => 'http://vmpooler.com',
622
- 'token' => 'krypto-knight',
623
- 'user' => 'foo',
624
- 'type' => 'vmpooler'
625
- })
638
+ 'url' => 'http://vmpooler.com',
639
+ 'token' => 'krypto-knight',
640
+ 'user' => 'foo',
641
+ 'type' => 'vmpooler'
642
+ })
626
643
  end
627
644
  end
628
645
  end