Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning- committed Feb 22, 2024
1 parent 89f4c5e commit ae452d6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion spec/acceptance/galera_codership_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class { 'galera':
deb_sysmaint_password => 'sysmaint',
configure_firewall => false,
galera_servers => ['127.0.0.1'],
galera_master => $fqdn,
galera_master => $facts['networking']['fqdn'],
root_password => 'root_password',
status_password => 'status_password',
override_options => {
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/galera_debian_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

context 'when this node is the master' do
before(:each) do
facts.merge!(fqdn: 'control1')
facts.merge!(networking: {fqdn: 'control1'})
end
let(:node) { 'control1' }

Expand Down Expand Up @@ -69,7 +69,7 @@

context 'when this node is a slave' do
before(:each) do
facts.merge!(fqdn: 'slave')
facts.merge!(networking: {fqdn: 'slave'})
end
let(:node) { 'slave' }

Expand Down
8 changes: 4 additions & 4 deletions spec/classes/galera_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
end

context 'when node is the master' do
before(:each) { params.merge!(galera_master: facts[:fqdn]) }
before(:each) { params.merge!(galera_master: facts[:networking][:fqdn]) }
it { is_expected.to contain_exec('bootstrap_galera_cluster') }
end

context 'when node is not the master' do
before(:each) { params.merge!(galera_master: "not_#{facts[:fqdn]}") }
before(:each) { params.merge!(galera_master: "not_#{facts[:networking][:fqdn]}") }
it { is_expected.not_to contain_exec('bootstrap_galera_cluster') }
end

Expand Down Expand Up @@ -142,14 +142,14 @@
end

context 'when create_root_user=undef (default) and the master' do
before(:each) { params.merge!(galera_master: facts[:fqdn]) }
before(:each) { params.merge!(galera_master: facts[:networking][:fqdn]) }
it { is_expected.to contain_class('galera').with(create_root_user: nil) }
it { is_expected.to contain_class('mysql::server').with(create_root_user: true) }
it { is_expected.to contain_mysql_user('root@localhost') }
end

context 'when create_root_user=undef (default) and not the master' do
before(:each) { params.merge!(galera_master: "not_#{facts[:fqdn]}") }
before(:each) { params.merge!(galera_master: "not_#{facts[:networking][:fqdn]}") }
it { is_expected.to contain_class('mysql::server').with(create_root_user: false) }
it { is_expected.not_to contain_mysql_user('root@localhost') }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/galera_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
end

context 'when node is the master' do
before(:each) { params.merge!(galera_master: facts[:fqdn]) }
before(:each) { params.merge!(galera_master: facts[:networking][:fqdn]) }
it { is_expected.to contain_exec('bootstrap_galera_cluster').with_command(%r{systemctl start [email protected]}) }
end

Expand All @@ -52,7 +52,7 @@

shared_examples_for 'galera on RedHat 6' do
context 'when node is the master' do
before(:each) { params.merge!(galera_master: facts[:fqdn]) }
before(:each) { params.merge!(galera_master: facts[:networking][:fqdn]) }
it { is_expected.to contain_exec('bootstrap_galera_cluster').with_command(%r{/etc/init.d/mysql bootstrap-pxc}) }
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/default_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ networking:
ip: "172.16.254.254"
ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
mac: "AA:AA:AA:AA:AA:AA"
fqdn: localhost
is_pe: false
root_home: "/root"
fqdn: localhost

0 comments on commit ae452d6

Please sign in to comment.