Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow volumes without replicas #168

Merged
merged 4 commits into from
Jul 1, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
if $replica {
$_replica = "replica ${replica}"
} else {
$_replica = undef
$_replica = ''
}

$_transport = "transport ${transport}"
Expand Down
33 changes: 33 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,39 @@
end
end

context 'when volumes defined without replica' do
let :facts do
super().merge(
gluster_binary: '/sbin/gluster',
gluster_peer_list: 'example1,example2',
gluster_volume_list: 'gl1.example.com:/glusterfs/backup,gl2.example.com:/glusterfs/backup'
)
end
let :params do
{
volumes:
{
'data1' => {
'bricks' => ['srv1.local:/brick1/brick', 'srv2.local:/brick1/brick']
}
}
}
end

it 'creates gluster::volume' do
is_expected.to contain_gluster__volume('data1').with(
name: 'data1',
replica: nil,
bricks: ['srv1.local:/brick1/brick', 'srv2.local:/brick1/brick']
)
end
it 'executes command without replica' do
is_expected.not_to contain_exec('gluster create volume data1').with(
command: %r{.* replica .*}
)
end
end

context 'when volumes incorrectly defined' do
let :params do
{
Expand Down