|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require 'spec_helper' |
| 4 | + |
| 5 | +describe 'mysql::innobackupex_args' do |
| 6 | + it 'exists' do |
| 7 | + expect(subject).not_to be_nil |
| 8 | + end |
| 9 | + |
| 10 | + it 'accepts empty strings as puppet undef' do |
| 11 | + expect(subject).to run.with_params('', true, '', [], []) |
| 12 | + end |
| 13 | + |
| 14 | + context 'should work with username and password' do |
| 15 | + it 'returns args with username and password' do |
| 16 | + expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') |
| 17 | + end |
| 18 | + |
| 19 | + it 'returns args with database lists' do |
| 20 | + expect(subject).to run.with_params('root', false, '12345', ['db1', 'db2'], []).and_return('--user="root" --password="12345" --databases="db1 db2"') |
| 21 | + end |
| 22 | + |
| 23 | + it 'returns args with backup compress only' do |
| 24 | + expected_results = '--user="root" --password="12345" --compress' |
| 25 | + expect(subject).to run.with_params('root', true, '12345', [], []).and_return(expected_results) |
| 26 | + end |
| 27 | + |
| 28 | + it 'returns args with backup compress, database list and optional_args' do |
| 29 | + expected_results = '--user="root" --password="12345" --compress --databases="db1 db2" tst_arg_1 tst_arg_2' |
| 30 | + expect(subject).to run.with_params('root', true, '12345', ['db1', 'db2'], ['tst_arg_1', 'tst_arg_2']).and_return(expected_results) |
| 31 | + end |
| 32 | + end |
| 33 | + |
| 34 | + context 'should work without database args' do |
| 35 | + it 'returns args without database list' do |
| 36 | + expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') |
| 37 | + end |
| 38 | + end |
| 39 | + |
| 40 | + it 'returns args without backup compress' do |
| 41 | + expect(subject).to run.with_params('root', false, '12345', [], []).and_return('--user="root" --password="12345"') |
| 42 | + end |
| 43 | + |
| 44 | + it 'returns args with backup compress and database list' do |
| 45 | + expected_results = '--user="root" --password="12345" --compress --databases="db1 db2"' |
| 46 | + expect(subject).to run.with_params('root', true, '12345', ['db1', 'db2'], []).and_return(expected_results) |
| 47 | + end |
| 48 | + |
| 49 | + it 'returns args without backup compress database list and optional_args' do |
| 50 | + expected_results = '--user="root" --password="12345" --databases="db1 db2" tst_arg_1 tst_arg_2' |
| 51 | + expect(subject).to run.with_params('root', false, '12345', ['db1', 'db2'], ['tst_arg_1', 'tst_arg_2']).and_return(expected_results) |
| 52 | + end |
| 53 | + |
| 54 | + it 'returns args without backup compress database list and with optional_args' do |
| 55 | + expected_results = '--user="root" --password="12345" tst_arg_1 tst_arg_2' |
| 56 | + expect(subject).to run.with_params('root', false, '12345', [], ['tst_arg_1', 'tst_arg_2']).and_return(expected_results) |
| 57 | + end |
| 58 | +end |
0 commit comments