source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/acceptance/fqdn_rotate_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 include_context "with faked facts"
7 context "when the FQDN is 'fakehost.localdomain'" do
8 before :each do
9 fake_fact("fqdn", "fakehost.localdomain")
10 end
11
12 it 'rotates arrays' do
13 pp = <<-EOS
14 $a = ['a','b','c','d']
15 $o = fqdn_rotate($a)
16 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
17 EOS
18
19 apply_manifest(pp, :catch_failures => true) do |r|
20 expect(r.stdout).to match(/fqdn_rotate is \["d", "a", "b", "c"\]/)
21 end
22 end
23 it 'rotates arrays with custom seeds' do
24 pp = <<-EOS
25 $a = ['a','b','c','d']
26 $s = 'seed'
27 $o = fqdn_rotate($a, $s)
28 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
29 EOS
30
31 apply_manifest(pp, :catch_failures => true) do |r|
32 expect(r.stdout).to match(/fqdn_rotate is \["c", "d", "a", "b"\]/)
33 end
34 end
35 it 'rotates strings' do
36 pp = <<-EOS
37 $a = 'abcd'
38 $o = fqdn_rotate($a)
39 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
40 EOS
41
42 apply_manifest(pp, :catch_failures => true) do |r|
43 expect(r.stdout).to match(/fqdn_rotate is "dabc"/)
44 end
45 end
46 it 'rotates strings with custom seeds' do
47 pp = <<-EOS
48 $a = 'abcd'
49 $s = 'seed'
50 $o = fqdn_rotate($a, $s)
51 notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
52 EOS
53
54 apply_manifest(pp, :catch_failures => true) do |r|
55 expect(r.stdout).to match(/fqdn_rotate is "cdab"/)
56 end
57 end
58 end
59 end
60 describe 'failure' do
61 it 'handles improper argument counts'
62 it 'handles invalid arguments'
63 end
64end
Note: See TracBrowser for help on using the repository browser.