+ it 'accepts and convert the max-length-bytes value' do
+ definition = { 'max-length-bytes' => '1800000' }
+ policy[:definition] = definition
+ expect(policy[:definition]['max-length-bytes']).to eq(1_800_000)
+ end
+
+ it 'does not accept non-numeric max-length-bytes value' do
+ definition = { 'max-length-bytes' => 'future' }
+ expect do
+ policy[:definition] = definition
+ end.to raise_error(Puppet::Error, %r{Invalid max-length-bytes value.*future})
+ end
+
+ it 'accepts and convert the shards-per-node value' do
+ definition = { 'shards-per-node' => '1800000' }
+ policy[:definition] = definition
+ expect(policy[:definition]['shards-per-node']).to eq(1_800_000)
+ end
+
+ it 'does not accept non-numeric shards-per-node value' do
+ definition = { 'shards-per-node' => 'future' }
+ expect do
+ policy[:definition] = definition
+ end.to raise_error(Puppet::Error, %r{Invalid shards-per-node value.*future})
+ end
+
+ it 'accepts and convert the ha-sync-batch-size value' do
+ definition = { 'ha-sync-batch-size' => '1800000' }
+ policy[:definition] = definition
+ expect(policy[:definition]['ha-sync-batch-size']).to eq(1_800_000)
+ end
+
+ it 'does not accept non-numeric ha-sync-batch-size value' do
+ definition = { 'ha-sync-batch-size' => 'future' }
+ expect do
+ policy[:definition] = definition
+ end.to raise_error(Puppet::Error, %r{Invalid ha-sync-batch-size value.*future})
+ end
+
+ context 'accepts list value in ha-params when ha-mode = nodes' do
+ before do
+ policy[:definition] = definition
+ end
+
+ let(:definition) { { 'ha-mode' => 'nodes', 'ha-params' => ['rabbit@rabbit-01', 'rabbit@rabbit-02'] } }
+
+ it { expect(policy[:definition]['ha-mode']).to eq('nodes') }
+ it { expect(policy[:definition]['ha-params']).to be_a(Array) }
+ it { expect(policy[:definition]['ha-params'][0]).to eq('rabbit@rabbit-01') }
+ it { expect(policy[:definition]['ha-params'][1]).to eq('rabbit@rabbit-02') }