nova_db_sync_api_spec.rb 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. require 'spec_helper'
  2. describe 'nova::db::sync_api' do
  3. shared_examples_for 'nova-dbsync-api' do
  4. context 'with defaults' do
  5. it {
  6. is_expected.to contain_exec('nova-db-sync-api').with(
  7. :command => '/usr/bin/nova-manage api_db sync',
  8. :refreshonly => 'true',
  9. :timeout => 300,
  10. :logoutput => 'on_failure',
  11. :subscribe => ['Anchor[nova::install::end]',
  12. 'Anchor[nova::config::end]',
  13. 'Anchor[nova::db::end]',
  14. 'Anchor[nova::dbsync_api::begin]'],
  15. :notify => 'Anchor[nova::dbsync_api::end]',
  16. )
  17. }
  18. it { is_expected.to_not contain_class('nova::cell_v2::simple_setup') }
  19. end
  20. context "overriding extra_params" do
  21. let :params do
  22. {
  23. :extra_params => '--config-file /etc/nova/nova.conf',
  24. :cellv2_setup => false
  25. }
  26. end
  27. it {
  28. is_expected.to contain_exec('nova-db-sync-api').with(
  29. :command => '/usr/bin/nova-manage --config-file /etc/nova/nova.conf api_db sync',
  30. :refreshonly => 'true',
  31. :timeout => 300,
  32. :logoutput => 'on_failure',
  33. :subscribe => ['Anchor[nova::install::end]',
  34. 'Anchor[nova::config::end]',
  35. 'Anchor[nova::db::end]',
  36. 'Anchor[nova::dbsync_api::begin]'],
  37. :notify => 'Anchor[nova::dbsync_api::end]',
  38. )
  39. }
  40. it { is_expected.to_not contain_class('nova::cell_v2::simple_setup') }
  41. end
  42. context "overriding db_sync_timeout" do
  43. let :params do
  44. {
  45. :db_sync_timeout => 750
  46. }
  47. end
  48. it {
  49. is_expected.to contain_exec('nova-db-sync-api').with(
  50. :command => '/usr/bin/nova-manage api_db sync',
  51. :refreshonly => 'true',
  52. :timeout => 750,
  53. :logoutput => 'on_failure',
  54. :subscribe => ['Anchor[nova::install::end]',
  55. 'Anchor[nova::config::end]',
  56. 'Anchor[nova::db::end]',
  57. 'Anchor[nova::dbsync_api::begin]'],
  58. :notify => 'Anchor[nova::dbsync_api::end]',
  59. )
  60. }
  61. end
  62. end
  63. on_supported_os({
  64. :supported_os => OSDefaults.get_supported_os
  65. }).each do |os,facts|
  66. context "on #{os}" do
  67. let (:facts) do
  68. facts.merge(OSDefaults.get_facts())
  69. end
  70. it_configures 'nova-dbsync-api'
  71. end
  72. end
  73. end