From e34e7ef628f36672c598ec08cada0f940bbf5336 Mon Sep 17 00:00:00 2001 From: Denis Egorenko Date: Mon, 18 Jan 2016 20:49:11 +0300 Subject: [PATCH] Change db-sync command for gnocchi and drop mock Note: the 3 changes need to be in the same commit because CI is broken at this time. Change #1 In Mitaka gnocchi-dbsync was moved to gnocchi-upgrade [1,2]. [1] https://github.com/openstack-packages/gnocchi/commit/aee5df615e03427ab76658b8c311f2633290fda1 [2] https://review.openstack.org/#/c/245069/5/setup.cfg Partial-bug: #1535382 Change #2 drop mock dependency mock is not used anywhere in the module, let's drop it. This patch will help to hit this bug: https://launchpad.net/bugs/1492636 Related-Bug: #1492636 Depends-On: I3ac207f744847b5742fc331d2c16d1dad475f9ea Change-Id: I1e88361018fbbff42cae7e57f2e039fa45eaaeb1 --- Gemfile | 1 - manifests/db/sync.pp | 3 +- spec/classes/gnocchi_db_sync_spec.rb | 43 ++++++++++++++++++++++++++++ spec/spec_helper.rb | 1 - 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 spec/classes/gnocchi_db_sync_spec.rb 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'