diff --git a/Gemfile b/Gemfile index 5ad0760c..efeba2a4 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,6 @@ group :development, :test do gem 'puppet-lint-variable_contains_upcase', :require => 'false' gem 'puppet-lint-numericvariable', :require => 'false' gem 'json', :require => 'false' - gem 'webmock', :require => 'false' gem 'puppet-openstack_spec_helper', :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper', :require => false diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 7d3e35a4..d6f66be9 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -8,8 +8,9 @@ class gnocchi::db::sync ( $user = 'gnocchi', ){ + exec { 'gnocchi-db-sync': - command => 'gnocchi-dbsync --config-file /etc/gnocchi/gnocchi.conf', + command => 'gnocchi-upgrade --config-file /etc/gnocchi/gnocchi.conf', path => '/usr/bin', refreshonly => true, user => $user, diff --git a/spec/classes/gnocchi_db_sync_spec.rb b/spec/classes/gnocchi_db_sync_spec.rb new file mode 100644 index 00000000..1ae29d0a --- /dev/null +++ b/spec/classes/gnocchi_db_sync_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe 'gnocchi::db::sync' do + + shared_examples_for 'gnocchi-dbsync' do + + it 'runs gnocchi-manage db_sync' do + is_expected.to contain_exec('gnocchi-db-sync').with( + :command => 'gnocchi-upgrade --config-file /etc/gnocchi/gnocchi.conf', + :path => '/usr/bin', + :user => 'gnocchi', + :refreshonly => 'true', + :logoutput => 'on_failure' + ) + end + + end + + + context 'on a RedHat osfamily' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '7.0', + } + end + + it_configures 'gnocchi-dbsync' + end + + context 'on a Debian osfamily' do + let :facts do + { + :operatingsystemrelease => '7.8', + :operatingsystem => 'Debian', + :osfamily => 'Debian', + } + end + + it_configures 'gnocchi-dbsync' + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bd97904b..be3811cf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,5 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' -require 'webmock/rspec' require 'puppet-openstack_spec_helper/defaults' require 'rspec-puppet-facts'