File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 6969 if $replica {
7070 $_replica = " replica ${replica} "
7171 } else {
72- $_replica = undef
72+ $_replica = ' '
7373 }
7474
7575 $_transport = " transport ${transport} "
7676
77- if $options {
77+ if $options and ! empty( $options ) {
7878 $_options = sort( $options )
7979 } else {
8080 $_options = undef
Original file line number Diff line number Diff line change 139139 end
140140 end
141141
142+ context 'when volumes defined without replica' do
143+ let :facts do
144+ super ( ) . merge (
145+ gluster_binary : '/sbin/gluster' ,
146+ gluster_peer_list : 'example1,example2' ,
147+ gluster_volume_list : 'gl1.example.com:/glusterfs/backup,gl2.example.com:/glusterfs/backup'
148+ )
149+ end
150+ let :params do
151+ {
152+ volumes :
153+ {
154+ 'data1' => {
155+ 'bricks' => [ 'srv1.local:/brick1/brick' , 'srv2.local:/brick1/brick' ]
156+ }
157+ }
158+ }
159+ end
160+
161+ it 'creates gluster::volume' do
162+ is_expected . to contain_gluster__volume ( 'data1' ) . with (
163+ name : 'data1' ,
164+ replica : nil ,
165+ bricks : [ 'srv1.local:/brick1/brick' , 'srv2.local:/brick1/brick' ]
166+ )
167+ end
168+ it 'executes command without replica' do
169+ is_expected . not_to contain_exec ( 'gluster create volume data1' ) . with (
170+ command : %r{.* replica .*}
171+ )
172+ end
173+ end
174+
142175 context 'when volumes incorrectly defined' do
143176 let :params do
144177 {
Original file line number Diff line number Diff line change 107107 it { is_expected . to compile . with_all_deps }
108108 it { is_expected . to contain_exec ( "gluster create volume #{ title } " ) }
109109 end
110+ describe 'with empty options' do
111+ let ( :facts ) do
112+ {
113+ gluster_binary : '/usr/sbin/gluster'
114+ }
115+ end
116+ let ( :params ) do
117+ super ( ) . merge ( options : [ ] )
118+ end
119+
120+ it { is_expected . to compile . with_all_deps }
121+ end
110122end
You can’t perform that action at this time.
0 commit comments