|
18 | 18 | solaris_agents.each do |agent| |
19 | 19 | it 'can create an idempotent zpool resource' do |
20 | 20 | # ZPool: create zpool disk |
21 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do |
22 | | - assert_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 21 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do |result| |
| 22 | + assert_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
23 | 23 | end |
24 | 24 |
|
25 | 25 | # ZPool: zpool should be idempotent |
26 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do |
27 | | - assert_no_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 26 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do |result| |
| 27 | + refute_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
28 | 28 | end |
29 | 29 |
|
30 | 30 | # ZPool: remove zpool |
31 | | - apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |
32 | | - assert_match(%r{ensure: removed}, @result.stdout, "err: #{agent}") |
| 31 | + apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |result| |
| 32 | + assert_match(%r{ensure: removed}, result.stdout, "err: #{agent}") |
33 | 33 | end |
34 | 34 | end |
35 | 35 |
|
36 | 36 | it 'can create a zpool resource with a disk array' do |
37 | 37 | # ZPool: create zpool with a disk array |
38 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>['/ztstpool/dsk1','/ztstpool/dsk2'] }") do |
39 | | - assert_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 38 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>['/ztstpool/dsk1','/ztstpool/dsk2'] }") do |result| |
| 39 | + assert_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
40 | 40 | end |
41 | 41 |
|
42 | 42 | # ZPool: verify disk array was created |
43 | | - on agent, 'zpool list -H' do |
44 | | - assert_match(%r{tstpool}, @result.stdout, "err: #{agent}") |
| 43 | + on(agent, 'zpool list -H') do |result| |
| 44 | + assert_match(%r{tstpool}, result.stdout, "err: #{agent}") |
45 | 45 | end |
46 | 46 |
|
47 | 47 | # ZPool: verify puppet resource reports on the disk array |
48 | | - on(agent, puppet('resource zpool tstpool')) do |
49 | | - assert_match(%r{ensure\s+=> 'present'}, @result.stdout, "err: #{agent}") |
50 | | - assert_match(%r{disk +=> .'.+dsk1 .+dsk2'.}, @result.stdout, "err: #{agent}") |
| 48 | + on(agent, puppet('resource zpool tstpool')) do |result| |
| 49 | + assert_match(%r{ensure\s+=> 'present'}, result.stdout, "err: #{agent}") |
| 50 | + assert_match(%r{disk +=> .'.+dsk1 .+dsk2'.}, result.stdout, "err: #{agent}") |
51 | 51 | end |
52 | 52 |
|
53 | 53 | # ZPool: remove zpool in preparation for mirror tests |
54 | | - apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |
55 | | - assert_match(%r{ensure: removed}, @result.stdout, "err: #{agent}") |
| 54 | + apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |result| |
| 55 | + assert_match(%r{ensure: removed}, result.stdout, "err: #{agent}") |
56 | 56 | end |
57 | 57 | end |
58 | 58 |
|
59 | 59 | it 'can create a mirrored zpool resource with 3 virtual devices' do |
60 | 60 | # ZPool: create mirrored zpool with 3 virtual devices |
61 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, mirror=>['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'] }") do |
62 | | - assert_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 61 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, mirror=>['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'] }") do |result| |
| 62 | + assert_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
63 | 63 | end |
64 | 64 |
|
65 | 65 | # ZPool: verify mirrors were created |
66 | | - on agent, 'zpool status -v tstpool' do |
| 66 | + on(agent, 'zpool status -v tstpool') do |result| |
67 | 67 | # NAME STATE READ WRITE CKSUM |
68 | 68 | # tstpool ONLINE 0 0 0 |
69 | 69 | # mirror-0 ONLINE 0 0 0 |
70 | 70 | # /ztstpool/dsk1 ONLINE 0 0 0 |
71 | 71 | # /ztstpool/dsk2 ONLINE 0 0 0 |
72 | 72 | # /ztstpool/dsk3 ONLINE 0 0 0 |
73 | | - assert_match(%r{tstpool.*\n\s+mirror.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s*/ztstpool/dsk3}m, @result.stdout, "err: #{agent}") |
| 73 | + assert_match(%r{tstpool.*\n\s+mirror.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s*/ztstpool/dsk3}m, result.stdout, "err: #{agent}") |
74 | 74 | end |
75 | 75 |
|
76 | 76 | # ZPool: verify puppet resource reports on the mirror |
77 | | - on(agent, puppet('resource zpool tstpool')) do |
78 | | - assert_match(%r{ensure\s+=> 'present'}, @result.stdout, "err: #{agent}") |
79 | | - assert_match(%r{mirror\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'\]}, @result.stdout, "err: #{agent}") |
| 77 | + on(agent, puppet('resource zpool tstpool')) do |result| |
| 78 | + assert_match(%r{ensure\s+=> 'present'}, result.stdout, "err: #{agent}") |
| 79 | + assert_match(%r{mirror\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'\]}, result.stdout, "err: #{agent}") |
80 | 80 | end |
81 | 81 |
|
82 | 82 | # ZPool: remove zpool in preparation for multiple mirrors |
83 | | - apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |
84 | | - assert_match(%r{ensure: removed}, @result.stdout, "err: #{agent}") |
| 83 | + apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |result| |
| 84 | + assert_match(%r{ensure: removed}, result.stdout, "err: #{agent}") |
85 | 85 | end |
86 | 86 | end |
87 | 87 |
|
88 | 88 | it 'can create two mirrored zpools each with two virtual devices' do |
89 | 89 | # ZPool: create 2 mirrored zpools each with 2 virtual devices |
90 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, mirror=>['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'] }") do |
91 | | - assert_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 90 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, mirror=>['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'] }") do |result| |
| 91 | + assert_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
92 | 92 | end |
93 | 93 |
|
94 | 94 | # ZPool: verify both mirrors were created |
95 | | - on agent, 'zpool status -v tstpool' do |
| 95 | + on(agent, 'zpool status -v tstpool') do |result| |
96 | 96 | # NAME STATE READ WRITE CKSUM |
97 | 97 | # tstpool ONLINE 0 0 0 |
98 | 98 | # mirror-0 ONLINE 0 0 0 |
|
101 | 101 | # mirror-1 ONLINE 0 0 0 |
102 | 102 | # /ztstpool/dsk3 ONLINE 0 0 0 |
103 | 103 | # /ztstpool/dsk5 ONLINE 0 0 0 |
104 | | - assert_match(%r{tstpool.*\n\s+mirror.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s+mirror.*\n\s*/ztstpool\/dsk3.*\n\s*/ztstpool/dsk5}m, @result.stdout, "err: #{agent}") |
| 104 | + assert_match(%r{tstpool.*\n\s+mirror.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s+mirror.*\n\s*/ztstpool\/dsk3.*\n\s*/ztstpool/dsk5}m, result.stdout, "err: #{agent}") |
105 | 105 | end |
106 | 106 |
|
107 | 107 | # ZPool: verify puppet resource reports on both mirrors |
108 | | - on(agent, puppet('resource zpool tstpool')) do |
109 | | - assert_match(%r{ensure\s+=> 'present'}, @result.stdout, "err: #{agent}") |
110 | | - assert_match(%r{mirror\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'\]}, @result.stdout, "err: #{agent}") |
| 108 | + on(agent, puppet('resource zpool tstpool')) do |result| |
| 109 | + assert_match(%r{ensure\s+=> 'present'}, result.stdout, "err: #{agent}") |
| 110 | + assert_match(%r{mirror\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'\]}, result.stdout, "err: #{agent}") |
111 | 111 | end |
112 | 112 |
|
113 | 113 | # ZPool: remove zpool in preparation for raidz test |
114 | | - apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |
115 | | - assert_match(%r{ensure: removed}, @result.stdout, "err: #{agent}") |
| 114 | + apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |result| |
| 115 | + assert_match(%r{ensure: removed}, result.stdout, "err: #{agent}") |
116 | 116 | end |
117 | 117 | end |
118 | 118 |
|
119 | 119 | it 'can create raidz pool consisting of three virtual devices' do |
120 | 120 | # ZPool: create raidz pool consisting of 3 virtual devices |
121 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, raidz=>['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'] }") do |
122 | | - assert_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 121 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, raidz=>['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'] }") do |result| |
| 122 | + pp "THIS IS THE RESULT: #{result} THIS IS THE RESULT'S CLASS #{result.class}" |
| 123 | + pp "THIS IS THE RESULT METHODS #{result.methods.sort}" |
| 124 | + pp "RESULT.STDOUT IS #{result.stdout} RESULT.STDERR IS #{result.stderr}" |
| 125 | + assert_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
123 | 126 | end |
124 | 127 |
|
125 | 128 | # ZPool: verify raidz pool was created |
126 | | - on agent, 'zpool status -v tstpool' do |
| 129 | + on(agent, 'zpool status -v tstpool') do |result| |
127 | 130 | # NAME STATE READ WRITE CKSUM |
128 | 131 | # tstpool ONLINE 0 0 0 |
129 | 132 | # raidz1-0 ONLINE 0 0 0 |
130 | 133 | # /ztstpool/dsk1 ONLINE 0 0 0 |
131 | 134 | # /ztstpool/dsk2 ONLINE 0 0 0 |
132 | 135 | # /ztstpool/dsk3 ONLINE 0 0 0 |
133 | | - assert_match(%r{tstpool.*\n\s+raidz.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s*/ztstpool/dsk3}m, @result.stdout, "err: #{agent}") |
| 136 | + assert_match(%r{tstpool.*\n\s+raidz.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s*/ztstpool/dsk3}m, result.stdout, "err: #{agent}") |
134 | 137 | end |
135 | 138 |
|
136 | 139 | # ZPool: verify puppet reports on the raidz pool |
137 | | - on(agent, puppet('resource zpool tstpool')) do |
138 | | - assert_match(%r{ensure\s+=> 'present'}, @result.stdout, "err: #{agent}") |
139 | | - assert_match(%r{raidz\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'\]}, @result.stdout, "err: #{agent}") |
| 140 | + on(agent, puppet('resource zpool tstpool')) do |result| |
| 141 | + assert_match(%r{ensure\s+=> 'present'}, result.stdout, "err: #{agent}") |
| 142 | + assert_match(%r{raidz\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2 /ztstpool/dsk3'\]}, result.stdout, "err: #{agent}") |
140 | 143 | end |
141 | 144 |
|
142 | 145 | # ZPool: remove zpool in preparation for multiple raidz pools |
143 | | - apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |
144 | | - assert_match(%r{ensure: removed}, @result.stdout, "err: #{agent}") |
| 146 | + apply_manifest_on(agent, 'zpool{ tstpool: ensure=>absent }') do |result| |
| 147 | + assert_match(%r{ensure: removed}, result.stdout, "err: #{agent}") |
145 | 148 | end |
146 | 149 | end |
147 | 150 |
|
148 | 151 | it 'can create two raidz zpools each with two virtual devices' do |
149 | 152 | # ZPool: create 2 mirrored zpools each with 2 virtual devices |
150 | | - apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, raidz=>['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'] }") do |
151 | | - assert_match(%r{ensure: created}, @result.stdout, "err: #{agent}") |
| 153 | + apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, raidz=>['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'] }") do |result| |
| 154 | + pp "THIS IS THE RESULT: #{result} THIS IS THE RESULT'S CLASS #{result.class}" |
| 155 | + pp "THIS IS THE RESULT METHODS #{result.methods.sort}" |
| 156 | + pp "RESULT.STDOUT IS #{result.stdout} RESULT.STDERR IS #{result.stderr}" |
| 157 | + assert_match(%r{ensure: created}, result.stdout, "err: #{agent}") |
152 | 158 | end |
153 | 159 |
|
154 | 160 | # ZPool: verify both raidz were created |
155 | | - on agent, 'zpool status -v tstpool' do |
| 161 | + on(agent, 'zpool status -v tstpool') do |result| |
156 | 162 | # NAME STATE READ WRITE CKSUM |
157 | 163 | # tstpool ONLINE 0 0 0 |
158 | 164 | # raidz1-0 ONLINE 0 0 0 |
|
161 | 167 | # raidz1-1 ONLINE 0 0 0 |
162 | 168 | # /ztstpool/dsk3 ONLINE 0 0 0 |
163 | 169 | # /ztstpool/dsk5 ONLINE 0 0 0 |
164 | | - assert_match(%r{tstpool.*\n\s+raidz.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s+raidz.*\n\s*/ztstpool/dsk3.*\n\s*/ztstpool/dsk5}m, @result.stdout, "err: #{agent}") |
| 170 | + assert_match(%r{tstpool.*\n\s+raidz.*\n\s*/ztstpool/dsk1.*\n\s*/ztstpool/dsk2.*\n\s+raidz.*\n\s*/ztstpool/dsk3.*\n\s*/ztstpool/dsk5}m, result.stdout, "err: #{agent}") |
165 | 171 | end |
166 | 172 |
|
167 | 173 | # ZPool: verify puppet resource reports on both raidz |
168 | | - on(agent, puppet('resource zpool tstpool')) do |
169 | | - assert_match(%r{ensure\s+=> 'present'}, @result.stdout, "err: #{agent}") |
170 | | - assert_match(%r{raidz\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'\]}, @result.stdout, "err: #{agent}") |
| 174 | + on(agent, puppet('resource zpool tstpool')) do |result| |
| 175 | + assert_match(%r{ensure\s+=> 'present'}, result.stdout, "err: #{agent}") |
| 176 | + assert_match(%r{raidz\s+=> \['/ztstpool/dsk1 /ztstpool/dsk2', '/ztstpool/dsk3 /ztstpool/dsk5'\]}, result.stdout, "err: #{agent}") |
171 | 177 | end |
172 | 178 |
|
173 | 179 | # ZPool: remove |
174 | | - apply_manifest_on(agent, 'zpool { tstpool: ensure => absent }') do |
175 | | - assert_match(%(ensure: removed), @result.stdout, "err: #{agent}") |
| 180 | + apply_manifest_on(agent, 'zpool { tstpool: ensure => absent }') do |result| |
| 181 | + assert_match(%(ensure: removed), result.stdout, "err: #{agent}") |
176 | 182 | end |
177 | 183 | end |
178 | 184 | end |
|
0 commit comments