Skip to content

Commit

Permalink
Add spec test for voxpupuli#291
Browse files Browse the repository at this point in the history
Closes voxpupuli#291

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie committed Aug 31, 2016
1 parent 2eef8be commit 6f7f3c3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2016-09-15 - Release 5.0.0
- Allow multiple rings in nodelist (#262, #291, #336)

# 2016-08-30 - Release 4.0.0
### Summary
- Validate corosync configuration before overwriting (available in EL7, Ubuntu
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,25 @@ class { 'corosync':
quorum_members_ids => [ 10, 11, 12 ],
}
```

Note: custom IDs may be required when adding or removing
nodes to a cluster on a fly. Then each node shall have an
unique and persistent ID.

*To have multiple rings in the nodelist*
```puppet
class { 'corosync':
set_votequorum => true,
quorum_members => [
['172.31.110.1', '172.31.111.1'],
['172.31.110.2', '172.31.111.2'],
],
}
```

When `quorum_members` is an array of arrays, each sub array represents one
host IP addresses.

### Configuring primitives

The resources that Corosync will manage can be referred to as a primitive.
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/corosync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@
end
end

context 'when set_quorum is true and quorum_members are an array of arrays' do
before do
params.merge!(
set_votequorum: true,
quorum_members: [
['172.31.10.1', '172.31.11.1', '172.31.12.1'],
['172.31.10.2', '172.31.11.2', '172.31.12.2'],
['172.31.10.3', '172.31.11.3', '172.31.12.3'],
['172.31.10.4', '172.31.11.4', '172.31.12.4'],
]
)
end

(1..4).each do |node_id|
it "configures rings for host #{node_id} correctly" do
should contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr: 172.31.10.#{node_id}\n\s*ring1_addr: 172.31.11.#{node_id}\n\s*ring2_addr: 172.31.12.#{node_id}\n\s*nodeid: #{node_id}}
)
end
end
end

context 'when unicast is used' do
before do
params.merge!(
Expand Down

0 comments on commit 6f7f3c3

Please sign in to comment.