spec: updates for rspec-puppet 2.x and rspec 3.x
This patch aim to update our specs test in order to work with the rspec-puppet release 2.0.0, in the mean time, we update rspec syntax in order to be prepared for rspec 3.x move. In details: * Use shared_examples "a Puppet::Error" for puppet::error tests * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x) * Fix spec tests for rspec-puppet 2.0.0 * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0 * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper) * Remove un-used puppet-lint (name_containing_dash config) Change-Id: I5488507176d4665895eef65ddb4b6f0fb4eda3e7 Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
This commit is contained in:
		
							
								
								
									
										6
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Gemfile
									
									
									
									
									
								
							@@ -2,13 +2,11 @@ source 'https://rubygems.org'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
group :development, :test do
 | 
					group :development, :test do
 | 
				
			||||||
  gem 'puppetlabs_spec_helper', :require => false
 | 
					  gem 'puppetlabs_spec_helper', :require => false
 | 
				
			||||||
 | 
					  gem 'rspec-puppet', '~> 2.0.0', :require => false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  gem 'metadata-json-lint'
 | 
					  gem 'metadata-json-lint'
 | 
				
			||||||
  gem 'puppet-lint-param-docs'
 | 
					  gem 'puppet-lint-param-docs'
 | 
				
			||||||
  gem 'puppet-lint', '~> 1.1'
 | 
					
 | 
				
			||||||
  gem 'rspec-puppet', '~> 1.0.1'
 | 
					 | 
				
			||||||
  gem 'rake', '10.1.1'
 | 
					 | 
				
			||||||
  gem 'rspec', '< 2.99'
 | 
					 | 
				
			||||||
  gem 'json'
 | 
					  gem 'json'
 | 
				
			||||||
  gem 'webmock'
 | 
					  gem 'webmock'
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,41 +38,41 @@ describe 'swift::bench' do
 | 
				
			|||||||
    let (:p) { default_params.merge!(params) }
 | 
					    let (:p) { default_params.merge!(params) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'depends on swift package' do
 | 
					    it 'depends on swift package' do
 | 
				
			||||||
      should contain_package('swift').with_before(/Swift_bench_config\[.+\]/)
 | 
					      is_expected.to contain_package('swift').with_before(/Swift_bench_config\[.+\]/)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'configures swift-bench.conf' do
 | 
					    it 'configures swift-bench.conf' do
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/auth').with_value(p[:auth_url])
 | 
					        'bench/auth').with_value(p[:auth_url])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/user').with_value(p[:swift_user])
 | 
					        'bench/user').with_value(p[:swift_user])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/key').with_value(p[:swift_key])
 | 
					        'bench/key').with_value(p[:swift_key])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/auth_version').with_value(p[:auth_version])
 | 
					        'bench/auth_version').with_value(p[:auth_version])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/log-level').with_value(p[:log_level])
 | 
					        'bench/log-level').with_value(p[:log_level])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/timeout').with_value(p[:test_timeout])
 | 
					        'bench/timeout').with_value(p[:test_timeout])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/put_concurrency').with_value(p[:put_concurrency])
 | 
					        'bench/put_concurrency').with_value(p[:put_concurrency])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/get_concurrency').with_value(p[:get_concurrency])
 | 
					        'bench/get_concurrency').with_value(p[:get_concurrency])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/get_concurrency').with_value(p[:get_concurrency])
 | 
					        'bench/get_concurrency').with_value(p[:get_concurrency])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/lower_object_size').with_value(p[:lower_object_size])
 | 
					        'bench/lower_object_size').with_value(p[:lower_object_size])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/upper_object_size').with_value(p[:upper_object_size])
 | 
					        'bench/upper_object_size').with_value(p[:upper_object_size])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/object_size').with_value(p[:object_size])
 | 
					        'bench/object_size').with_value(p[:object_size])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/num_objects').with_value(p[:num_objects])
 | 
					        'bench/num_objects').with_value(p[:num_objects])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/num_gets').with_value(p[:num_gets])
 | 
					        'bench/num_gets').with_value(p[:num_gets])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/num_containers').with_value(p[:num_containers])
 | 
					        'bench/num_containers').with_value(p[:num_containers])
 | 
				
			||||||
      should contain_swift_bench_config(
 | 
					      is_expected.to contain_swift_bench_config(
 | 
				
			||||||
        'bench/delete').with_value(p[:delete])
 | 
					        'bench/delete').with_value(p[:delete])
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
require 'spec_helper'
 | 
					require 'spec_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe 'swift::client' do
 | 
					describe 'swift::client' do
 | 
				
			||||||
  it { should contain_package('swiftclient').with(
 | 
					  it { is_expected.to contain_package('swiftclient').with(
 | 
				
			||||||
    :ensure => 'present',
 | 
					    :ensure => 'present',
 | 
				
			||||||
    :name => 'python-swiftclient'
 | 
					    :name => 'python-swiftclient'
 | 
				
			||||||
  )}
 | 
					  )}
 | 
				
			||||||
@@ -12,7 +12,7 @@ describe 'swift::client' do
 | 
				
			|||||||
    let :params do
 | 
					    let :params do
 | 
				
			||||||
      {:ensure => 'latest'}
 | 
					      {:ensure => 'latest'}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it { should contain_package('swiftclient').with(
 | 
					    it { is_expected.to contain_package('swiftclient').with(
 | 
				
			||||||
      :ensure => 'latest',
 | 
					      :ensure => 'latest',
 | 
				
			||||||
      :name   => 'python-swiftclient'
 | 
					      :name   => 'python-swiftclient'
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@ describe 'swift::dispersion' do
 | 
				
			|||||||
    {}
 | 
					    {}
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file('/etc/swift/dispersion.conf').with(
 | 
					  it { is_expected.to contain_file('/etc/swift/dispersion.conf').with(
 | 
				
			||||||
    :ensure  => 'present',
 | 
					    :ensure  => 'present',
 | 
				
			||||||
    :owner   => 'swift',
 | 
					    :owner   => 'swift',
 | 
				
			||||||
    :group   => 'swift',
 | 
					    :group   => 'swift',
 | 
				
			||||||
@@ -40,34 +40,34 @@ describe 'swift::dispersion' do
 | 
				
			|||||||
    let (:p) { default_params.merge!(params) }
 | 
					    let (:p) { default_params.merge!(params) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'depends on swift package' do
 | 
					    it 'depends on swift package' do
 | 
				
			||||||
      should contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/)
 | 
					      is_expected.to contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'configures dispersion.conf' do
 | 
					    it 'configures dispersion.conf' do
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/auth_url').with_value(p[:auth_url])
 | 
					        'dispersion/auth_url').with_value(p[:auth_url])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/auth_version').with_value(p[:auth_version])
 | 
					        'dispersion/auth_version').with_value(p[:auth_version])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/auth_user').with_value("#{p[:auth_tenant]}:#{p[:auth_user]}")
 | 
					        'dispersion/auth_user').with_value("#{p[:auth_tenant]}:#{p[:auth_user]}")
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/auth_key').with_value(p[:auth_pass])
 | 
					        'dispersion/auth_key').with_value(p[:auth_pass])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/endpoint_type').with_value(p[:endpoint_type])
 | 
					        'dispersion/endpoint_type').with_value(p[:endpoint_type])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/swift_dir').with_value(p[:swift_dir])
 | 
					        'dispersion/swift_dir').with_value(p[:swift_dir])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/dispersion_coverage').with_value(p[:coverage])
 | 
					        'dispersion/dispersion_coverage').with_value(p[:coverage])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/retries').with_value(p[:retries])
 | 
					        'dispersion/retries').with_value(p[:retries])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/concurrency').with_value(p[:concurrency])
 | 
					        'dispersion/concurrency').with_value(p[:concurrency])
 | 
				
			||||||
      should contain_swift_dispersion_config(
 | 
					      is_expected.to contain_swift_dispersion_config(
 | 
				
			||||||
        'dispersion/dump_json').with_value(p[:dump_json])
 | 
					        'dispersion/dump_json').with_value(p[:dump_json])
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'triggers swift-dispersion-populate' do
 | 
					    it 'triggers swift-dispersion-populate' do
 | 
				
			||||||
      should contain_exec('swift-dispersion-populate').with(
 | 
					      is_expected.to contain_exec('swift-dispersion-populate').with(
 | 
				
			||||||
        :path      => ['/bin', '/usr/bin'],
 | 
					        :path      => ['/bin', '/usr/bin'],
 | 
				
			||||||
        :subscribe => 'File[/etc/swift/dispersion.conf]',
 | 
					        :subscribe => 'File[/etc/swift/dispersion.conf]',
 | 
				
			||||||
        :onlyif    => "swift -A #{p[:auth_url]} -U #{p[:auth_tenant]}:#{p[:auth_user]} -K #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '",
 | 
					        :onlyif    => "swift -A #{p[:auth_url]} -U #{p[:auth_tenant]}:#{p[:auth_user]} -K #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,7 @@ describe 'swift::keystone::auth' do
 | 
				
			|||||||
      it_configures 'keystone auth configuration'
 | 
					      it_configures 'keystone auth configuration'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ['admin', 'SwiftOperator'].each do |role_name|
 | 
					      ['admin', 'SwiftOperator'].each do |role_name|
 | 
				
			||||||
        it { should contain_keystone_role(role_name).with_ensure('present') }
 | 
					        it { is_expected.to contain_keystone_role(role_name).with_ensure('present') }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,7 +58,7 @@ describe 'swift::keystone::auth' do
 | 
				
			|||||||
      it_configures 'keystone auth configuration'
 | 
					      it_configures 'keystone auth configuration'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ['admin', 'SwiftOperator', 'Gopher'].each do |role_name|
 | 
					      ['admin', 'SwiftOperator', 'Gopher'].each do |role_name|
 | 
				
			||||||
        it { should contain_keystone_role(role_name).with_ensure('present') }
 | 
					        it { is_expected.to contain_keystone_role(role_name).with_ensure('present') }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -67,7 +67,7 @@ describe 'swift::keystone::auth' do
 | 
				
			|||||||
        params.merge!(:configure_endpoint => false)
 | 
					        params.merge!(:configure_endpoint => false)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should_not contain_keystone_endpoint('RegionOne/swift') }
 | 
					      it { is_expected.to_not contain_keystone_endpoint('RegionOne/swift') }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context 'when disabling S3 endpoint' do
 | 
					    context 'when disabling S3 endpoint' do
 | 
				
			||||||
@@ -75,8 +75,8 @@ describe 'swift::keystone::auth' do
 | 
				
			|||||||
        params.merge!(:configure_s3_endpoint => false)
 | 
					        params.merge!(:configure_s3_endpoint => false)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should_not contain_keystone_service('swift_s3') }
 | 
					      it { is_expected.to_not contain_keystone_service('swift_s3') }
 | 
				
			||||||
      it { should_not contain_keystone_endpoint('RegionOne/swift_s3') }
 | 
					      it { is_expected.to_not contain_keystone_endpoint('RegionOne/swift_s3') }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -85,37 +85,37 @@ describe 'swift::keystone::auth' do
 | 
				
			|||||||
      default_params.merge( params )
 | 
					      default_params.merge( params )
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_user(p[:auth_name]).with(
 | 
					    it { is_expected.to contain_keystone_user(p[:auth_name]).with(
 | 
				
			||||||
      :ensure   => 'present',
 | 
					      :ensure   => 'present',
 | 
				
			||||||
      :password => p[:password],
 | 
					      :password => p[:password],
 | 
				
			||||||
      :email    => p[:email]
 | 
					      :email    => p[:email]
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with(
 | 
					    it { is_expected.to contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with(
 | 
				
			||||||
      :ensure  => 'present',
 | 
					      :ensure  => 'present',
 | 
				
			||||||
      :roles   => 'admin',
 | 
					      :roles   => 'admin',
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_service(p[:auth_name]).with(
 | 
					    it { is_expected.to contain_keystone_service(p[:auth_name]).with(
 | 
				
			||||||
      :ensure      => 'present',
 | 
					      :ensure      => 'present',
 | 
				
			||||||
      :type        => 'object-store',
 | 
					      :type        => 'object-store',
 | 
				
			||||||
      :description => 'Openstack Object-Store Service'
 | 
					      :description => 'Openstack Object-Store Service'
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}").with(
 | 
					    it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}").with(
 | 
				
			||||||
      :ensure       => 'present',
 | 
					      :ensure       => 'present',
 | 
				
			||||||
          :public_url   => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s",
 | 
					          :public_url   => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s",
 | 
				
			||||||
      :admin_url    => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}/",
 | 
					      :admin_url    => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}/",
 | 
				
			||||||
      :internal_url => "#{p[:internal_protocol]}://#{p[:internal_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s"
 | 
					      :internal_url => "#{p[:internal_protocol]}://#{p[:internal_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s"
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_service("#{p[:auth_name]}_s3").with(
 | 
					    it { is_expected.to contain_keystone_service("#{p[:auth_name]}_s3").with(
 | 
				
			||||||
    :ensure      => 'present',
 | 
					    :ensure      => 'present',
 | 
				
			||||||
    :type        => 's3',
 | 
					    :type        => 's3',
 | 
				
			||||||
    :description => 'Openstack S3 Service'
 | 
					    :description => 'Openstack S3 Service'
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}_s3").with(
 | 
					    it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}_s3").with(
 | 
				
			||||||
      :ensure       => 'present',
 | 
					      :ensure       => 'present',
 | 
				
			||||||
      :public_url   => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}",
 | 
					      :public_url   => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}",
 | 
				
			||||||
      :admin_url    => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}",
 | 
					      :admin_url    => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,14 +4,14 @@ describe 'swift::keystone::dispersion' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe 'with default class parameters' do
 | 
					  describe 'with default class parameters' do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_user('dispersion').with(
 | 
					    it { is_expected.to contain_keystone_user('dispersion').with(
 | 
				
			||||||
      :ensure   => 'present',
 | 
					      :ensure   => 'present',
 | 
				
			||||||
      :password => 'dispersion_password',
 | 
					      :password => 'dispersion_password',
 | 
				
			||||||
      :email    => 'swift@localhost',
 | 
					      :email    => 'swift@localhost',
 | 
				
			||||||
      :tenant   => 'services'
 | 
					      :tenant   => 'services'
 | 
				
			||||||
    ) }
 | 
					    ) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_user_role('dispersion@services').with(
 | 
					    it { is_expected.to contain_keystone_user_role('dispersion@services').with(
 | 
				
			||||||
      :ensure  => 'present',
 | 
					      :ensure  => 'present',
 | 
				
			||||||
      :roles   => 'admin',
 | 
					      :roles   => 'admin',
 | 
				
			||||||
      :require => 'Keystone_user[dispersion]'
 | 
					      :require => 'Keystone_user[dispersion]'
 | 
				
			||||||
@@ -29,14 +29,14 @@ describe 'swift::keystone::dispersion' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_user('bar').with(
 | 
					    it { is_expected.to contain_keystone_user('bar').with(
 | 
				
			||||||
      :ensure   => 'present',
 | 
					      :ensure   => 'present',
 | 
				
			||||||
      :password => 'foo',
 | 
					      :password => 'foo',
 | 
				
			||||||
      :email    => 'bar@example.com',
 | 
					      :email    => 'bar@example.com',
 | 
				
			||||||
      :tenant   => 'dummyTenant'
 | 
					      :tenant   => 'dummyTenant'
 | 
				
			||||||
    ) }
 | 
					    ) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_keystone_user_role('bar@dummyTenant') }
 | 
					    it { is_expected.to contain_keystone_user_role('bar@dummyTenant') }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ describe 'swift::proxy::account_quotas' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/80_swift_account_quotas"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/80_swift_account_quotas"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
        :group   => 'swift',
 | 
					        :group   => 'swift',
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it {should contain_file('/var/cache/swift').with(
 | 
					    it {is_expected.to contain_file('/var/cache/swift').with(
 | 
				
			||||||
      {:ensure => 'directory'}.merge(file_defaults)
 | 
					      {:ensure => 'directory'}.merge(file_defaults)
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -32,7 +32,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:authtoken]',
 | 
					          '[filter:authtoken]',
 | 
				
			||||||
          'log_name = swift',
 | 
					          'log_name = swift',
 | 
				
			||||||
@@ -61,7 +61,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:authtoken]',
 | 
					          '[filter:authtoken]',
 | 
				
			||||||
          'log_name = swift',
 | 
					          'log_name = swift',
 | 
				
			||||||
@@ -97,7 +97,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:authtoken]',
 | 
					          '[filter:authtoken]',
 | 
				
			||||||
          'log_name = swift',
 | 
					          'log_name = swift',
 | 
				
			||||||
@@ -124,7 +124,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
      { :auth_uri => 'http://public.host/keystone/main' }
 | 
					      { :auth_uri => 'http://public.host/keystone/main' }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)}
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)}
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [
 | 
					  [
 | 
				
			||||||
@@ -140,7 +140,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
        { :auth_admin_prefix => auth_admin_prefix }
 | 
					        { :auth_admin_prefix => auth_admin_prefix }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { expect { should contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \
 | 
					      it { expect { is_expected.to contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \
 | 
				
			||||||
        raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
 | 
					        raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@@ -153,7 +153,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:authtoken]',
 | 
					          '[filter:authtoken]',
 | 
				
			||||||
          'log_name = swift',
 | 
					          'log_name = swift',
 | 
				
			||||||
@@ -183,7 +183,7 @@ describe 'swift::proxy::authtoken' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:authtoken]',
 | 
					          '[filter:authtoken]',
 | 
				
			||||||
          'log_name = swift',
 | 
					          'log_name = swift',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@ describe 'swift::proxy::bulk' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:bulk]',
 | 
					          '[filter:bulk]',
 | 
				
			||||||
          'use = egg:swift#bulk',
 | 
					          'use = egg:swift#bulk',
 | 
				
			||||||
@@ -60,7 +60,7 @@ describe 'swift::proxy::bulk' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:bulk]',
 | 
					          '[filter:bulk]',
 | 
				
			||||||
          'use = egg:swift#bulk',
 | 
					          'use = egg:swift#bulk',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,12 +20,12 @@ describe 'swift::proxy::cache' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/23_swift_cache"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/23_swift_cache"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:cache]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:cache]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#memcache/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#memcache/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'with defaults' do
 | 
					  describe 'with defaults' do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -35,7 +35,7 @@ describe 'swift::proxy::cache' do
 | 
				
			|||||||
      {:memcache_servers => '10.0.0.1:1'}
 | 
					      {:memcache_servers => '10.0.0.1:1'}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -45,7 +45,7 @@ describe 'swift::proxy::cache' do
 | 
				
			|||||||
      {:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']}
 | 
					      {:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ describe 'swift::proxy::catch_errors' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/24_swift_catch_errors"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/24_swift_catch_errors"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:catch_errors]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:catch_errors]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,10 +21,10 @@ describe 'swift::proxy::ceilometer' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/33_swift_ceilometer"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/33_swift_ceilometer"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) }
 | 
				
			||||||
  it { should contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') }
 | 
					  it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') }
 | 
				
			||||||
  it { should contain_user('swift').with_groups('ceilometer') }
 | 
					  it { is_expected.to contain_user('swift').with_groups('ceilometer') }
 | 
				
			||||||
  it { should contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
 | 
					  it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ describe 'swift::proxy::container_quotas' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/81_swift_container_quotas"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/81_swift_container_quotas"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ describe 'swift::proxy::crossdomain' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:crossdomain]',
 | 
					          '[filter:crossdomain]',
 | 
				
			||||||
          'use = egg:swift#crossdomain',
 | 
					          'use = egg:swift#crossdomain',
 | 
				
			||||||
@@ -35,7 +35,7 @@ describe 'swift::proxy::crossdomain' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:crossdomain]',
 | 
					          '[filter:crossdomain]',
 | 
				
			||||||
          'use = egg:swift#crossdomain',
 | 
					          'use = egg:swift#crossdomain',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ describe 'swift::proxy::formpost' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/31_swift-proxy-formpost"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/31_swift-proxy-formpost"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:formpost]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:formpost]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#formpost/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#formpost/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ describe 'swift::proxy::gatekeeper' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:gatekeeper]',
 | 
					          '[filter:gatekeeper]',
 | 
				
			||||||
          'use = egg:swift#gatekeeper',
 | 
					          'use = egg:swift#gatekeeper',
 | 
				
			||||||
@@ -40,7 +40,7 @@ describe 'swift::proxy::gatekeeper' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:gatekeeper]',
 | 
					          '[filter:gatekeeper]',
 | 
				
			||||||
          'use = egg:swift#gatekeeper',
 | 
					          'use = egg:swift#gatekeeper',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ describe 'swift::proxy::healthcheck' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/25_swift_healthcheck"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/25_swift_healthcheck"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:healthcheck]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:healthcheck]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,15 +17,15 @@ describe 'swift::proxy::keystone' do
 | 
				
			|||||||
    '
 | 
					    '
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:keystone]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:keystone]/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'with defaults' do
 | 
					  describe 'with defaults' do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) }
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/is_admin = true/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/is_admin = true/) }
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -38,9 +38,9 @@ describe 'swift::proxy::keystone' do
 | 
				
			|||||||
        :reseller_prefix => 'SWIFT_'
 | 
					        :reseller_prefix => 'SWIFT_'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should contain_file(fragment_file).with_content(/operator_roles = foo/) }
 | 
					      it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = foo/) }
 | 
				
			||||||
      it { should contain_file(fragment_file).with_content(/is_admin = false/) }
 | 
					      it { is_expected.to contain_file(fragment_file).with_content(/is_admin = false/) }
 | 
				
			||||||
      it { should contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) }
 | 
					      it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ describe 'swift::proxy::ratelimit' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:ratelimit]',
 | 
					          '[filter:ratelimit]',
 | 
				
			||||||
          'use = egg:swift#ratelimit',
 | 
					          'use = egg:swift#ratelimit',
 | 
				
			||||||
@@ -42,7 +42,7 @@ describe 'swift::proxy::ratelimit' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:ratelimit]',
 | 
					          '[filter:ratelimit]',
 | 
				
			||||||
          'use = egg:swift#ratelimit',
 | 
					          'use = egg:swift#ratelimit',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,11 +15,11 @@ describe 'swift::proxy::s3token' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/28_swift_s3token"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/28_swift_s3token"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_class('keystone::python') }
 | 
					  it { is_expected.to contain_class('keystone::python') }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:s3token]',
 | 
					          '[filter:s3token]',
 | 
				
			||||||
          'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
 | 
					          'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
 | 
				
			||||||
@@ -40,7 +40,7 @@ describe 'swift::proxy::s3token' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:s3token]',
 | 
					          '[filter:s3token]',
 | 
				
			||||||
          'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
 | 
					          'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ describe 'swift::proxy::slo' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe "when using default parameters" do
 | 
					  describe "when using default parameters" do
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:slo]',
 | 
					          '[filter:slo]',
 | 
				
			||||||
          'use = egg:swift#slo',
 | 
					          'use = egg:swift#slo',
 | 
				
			||||||
@@ -42,7 +42,7 @@ describe 'swift::proxy::slo' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct parameters' do
 | 
					    it 'should build the fragment with correct parameters' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:slo]',
 | 
					          '[filter:slo]',
 | 
				
			||||||
          'use = egg:swift#slo',
 | 
					          'use = egg:swift#slo',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe 'without memcached being included' do
 | 
					  describe 'without memcached being included' do
 | 
				
			||||||
    it 'should raise an error' do
 | 
					    it 'should raise an error' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -28,9 +28,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'without the proxy local network ip address being specified' do
 | 
					    describe 'without the proxy local network ip address being specified' do
 | 
				
			||||||
      it "should fail" do
 | 
					      it_raises 'a Puppet::Error', /Must pass proxy_local_net_ip/
 | 
				
			||||||
        expect { subject }.to raise_error(Puppet::Error, /Must pass proxy_local_net_ip/)
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'when proxy_local_net_ip is set' do
 | 
					    describe 'when proxy_local_net_ip is set' do
 | 
				
			||||||
@@ -39,7 +37,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
        {:proxy_local_net_ip => '127.0.0.1'}
 | 
					        {:proxy_local_net_ip => '127.0.0.1'}
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should contain_service('swift-proxy').with(
 | 
					      it { is_expected.to contain_service('swift-proxy').with(
 | 
				
			||||||
        {:ensure    => 'running',
 | 
					        {:ensure    => 'running',
 | 
				
			||||||
         :provider  => 'upstart',
 | 
					         :provider  => 'upstart',
 | 
				
			||||||
         :enable    => true,
 | 
					         :enable    => true,
 | 
				
			||||||
@@ -47,7 +45,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
         :subscribe => 'Concat[/etc/swift/proxy-server.conf]'
 | 
					         :subscribe => 'Concat[/etc/swift/proxy-server.conf]'
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      )}
 | 
					      )}
 | 
				
			||||||
      it { should contain_file('/etc/swift/proxy-server.conf').with(
 | 
					      it { is_expected.to contain_file('/etc/swift/proxy-server.conf').with(
 | 
				
			||||||
        {:ensure  => 'present',
 | 
					        {:ensure  => 'present',
 | 
				
			||||||
         :owner   => 'swift',
 | 
					         :owner   => 'swift',
 | 
				
			||||||
         :group   => 'swift',
 | 
					         :group   => 'swift',
 | 
				
			||||||
@@ -56,7 +54,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
      )}
 | 
					      )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it 'should build the header file with all of the default contents' do
 | 
					      it 'should build the header file with all of the default contents' do
 | 
				
			||||||
        verify_contents(subject, fragment_path,
 | 
					        verify_contents(catalogue, fragment_path,
 | 
				
			||||||
          [
 | 
					          [
 | 
				
			||||||
            '[DEFAULT]',
 | 
					            '[DEFAULT]',
 | 
				
			||||||
            'bind_port = 8080',
 | 
					            'bind_port = 8080',
 | 
				
			||||||
@@ -80,7 +78,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
          ]
 | 
					          ]
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      it { should contain_concat__fragment('swift_proxy').with_before(
 | 
					      it { is_expected.to contain_concat__fragment('swift_proxy').with_before(
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          'Class[Swift::Proxy::Healthcheck]',
 | 
					          'Class[Swift::Proxy::Healthcheck]',
 | 
				
			||||||
          'Class[Swift::Proxy::Cache]',
 | 
					          'Class[Swift::Proxy::Cache]',
 | 
				
			||||||
@@ -105,7 +103,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        it 'should build the header file with provided values' do
 | 
					        it 'should build the header file with provided values' do
 | 
				
			||||||
          verify_contents(subject, fragment_path,
 | 
					          verify_contents(catalogue, fragment_path,
 | 
				
			||||||
            [
 | 
					            [
 | 
				
			||||||
              '[DEFAULT]',
 | 
					              '[DEFAULT]',
 | 
				
			||||||
              'bind_port = 80',
 | 
					              'bind_port = 80',
 | 
				
			||||||
@@ -125,7 +123,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
            ]
 | 
					            ]
 | 
				
			||||||
          )
 | 
					          )
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        it { should contain_concat__fragment('swift_proxy').with_before(
 | 
					        it { is_expected.to contain_concat__fragment('swift_proxy').with_before(
 | 
				
			||||||
          'Class[Swift::Proxy::Swauth]'
 | 
					          'Class[Swift::Proxy::Swauth]'
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
@@ -134,7 +132,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
        [:account_autocreate, :allow_account_management].each do |param|
 | 
					        [:account_autocreate, :allow_account_management].each do |param|
 | 
				
			||||||
          it "should fail when #{param} is not passed a boolean" do
 | 
					          it "should fail when #{param} is not passed a boolean" do
 | 
				
			||||||
            params[param] = 'false'
 | 
					            params[param] = 'false'
 | 
				
			||||||
            expect { subject }.to raise_error(Puppet::Error, /is not a boolean/)
 | 
					            expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -146,7 +144,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it "should fail if write_affinity_node_count is used without write_affinity" do
 | 
					        it "should fail if write_affinity_node_count is used without write_affinity" do
 | 
				
			||||||
          expect { subject }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
 | 
					          expect { catalogue }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
@@ -159,13 +157,13 @@ describe 'swift::proxy' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    [{ :enabled => true, :manage_service => true },
 | 
					    [{ :enabled => true, :manage_service => true },
 | 
				
			||||||
     { :enabled => false, :manage_service => true }].each do |param_hash|
 | 
					     { :enabled => false, :manage_service => true }].each do |param_hash|
 | 
				
			||||||
      context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
 | 
					      context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
 | 
				
			||||||
        before do
 | 
					        before do
 | 
				
			||||||
          params.merge!(param_hash)
 | 
					          params.merge!(param_hash)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it 'configures swift-proxy service' do
 | 
					        it 'configures swift-proxy service' do
 | 
				
			||||||
          should contain_service('swift-proxy').with(
 | 
					          is_expected.to contain_service('swift-proxy').with(
 | 
				
			||||||
            :ensure    => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
					            :ensure    => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
				
			||||||
            :name      => platform_params[:service_name],
 | 
					            :name      => platform_params[:service_name],
 | 
				
			||||||
            :provider  => platform_params[:service_provider],
 | 
					            :provider  => platform_params[:service_provider],
 | 
				
			||||||
@@ -185,7 +183,7 @@ describe 'swift::proxy' do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it 'configures swift-proxy service' do
 | 
					      it 'configures swift-proxy service' do
 | 
				
			||||||
        should contain_service('swift-proxy').with(
 | 
					        is_expected.to contain_service('swift-proxy').with(
 | 
				
			||||||
          :ensure    => nil,
 | 
					          :ensure    => nil,
 | 
				
			||||||
          :name      => platform_params[:service_name],
 | 
					          :name      => platform_params[:service_name],
 | 
				
			||||||
          :provider  => platform_params[:service_provider],
 | 
					          :provider  => platform_params[:service_provider],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ describe 'swift::proxy::staticweb' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/32_swift-proxy-staticweb"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/32_swift-proxy-staticweb"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:staticweb]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:staticweb]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,15 +15,15 @@ describe 'swift::proxy::swauth' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/20_swift_proxy_swauth"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/20_swift_proxy_swauth"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_package('python-swauth').with_ensure('present') }
 | 
					  it { is_expected.to contain_package('python-swauth').with_ensure('present') }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:swauth]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:swauth]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'with defaults' do
 | 
					  describe 'with defaults' do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) }
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -35,9 +35,9 @@ describe 'swift::proxy::swauth' do
 | 
				
			|||||||
       :package_ensure => 'latest' }
 | 
					       :package_ensure => 'latest' }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) }
 | 
				
			||||||
    it { should contain_file(fragment_file).with_content(/super_admin_key = foo/) }
 | 
					    it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = foo/) }
 | 
				
			||||||
    it { should contain_package('python-swauth').with_ensure('latest') }
 | 
					    it { is_expected.to contain_package('python-swauth').with_ensure('latest') }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,7 +16,7 @@ describe 'swift::proxy::swift3' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/27_swift_swift3"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/27_swift_swift3"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:swift3]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:swift3]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ describe 'swift::proxy::tempurl' do
 | 
				
			|||||||
    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/29_swift-proxy-tempurl"
 | 
					    "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/29_swift-proxy-tempurl"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/[filter:tempurl]/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/[filter:tempurl]/) }
 | 
				
			||||||
  it { should contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) }
 | 
					  it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ describe 'swift::ringbuilder' do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
  describe 'when swift class is not included' do
 | 
					  describe 'when swift class is not included' do
 | 
				
			||||||
    it 'should fail' do
 | 
					    it 'should fail' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  describe 'when swift class is included' do
 | 
					  describe 'when swift class is included' do
 | 
				
			||||||
@@ -21,14 +21,14 @@ describe 'swift::ringbuilder' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should rebalance the ring for all ring types' do
 | 
					    it 'should rebalance the ring for all ring types' do
 | 
				
			||||||
      should contain_swift__ringbuilder__rebalance('object')
 | 
					      is_expected.to contain_swift__ringbuilder__rebalance('object')
 | 
				
			||||||
      should contain_swift__ringbuilder__rebalance('account')
 | 
					      is_expected.to contain_swift__ringbuilder__rebalance('account')
 | 
				
			||||||
      should contain_swift__ringbuilder__rebalance('container')
 | 
					      is_expected.to contain_swift__ringbuilder__rebalance('container')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'with default parameters' do
 | 
					    describe 'with default parameters' do
 | 
				
			||||||
      ['object', 'account', 'container'].each do |type|
 | 
					      ['object', 'account', 'container'].each do |type|
 | 
				
			||||||
        it { should contain_swift__ringbuilder__create(type).with(
 | 
					        it { is_expected.to contain_swift__ringbuilder__create(type).with(
 | 
				
			||||||
          :part_power     => '18',
 | 
					          :part_power     => '18',
 | 
				
			||||||
          :replicas       => '3',
 | 
					          :replicas       => '3',
 | 
				
			||||||
          :min_part_hours => '24'
 | 
					          :min_part_hours => '24'
 | 
				
			||||||
@@ -46,7 +46,7 @@ describe 'swift::ringbuilder' do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ['object', 'account', 'container'].each do |type|
 | 
					      ['object', 'account', 'container'].each do |type|
 | 
				
			||||||
        it { should contain_swift__ringbuilder__create(type).with(
 | 
					        it { is_expected.to contain_swift__ringbuilder__create(type).with(
 | 
				
			||||||
          :part_power     => '19',
 | 
					          :part_power     => '19',
 | 
				
			||||||
          :replicas       => '3',
 | 
					          :replicas       => '3',
 | 
				
			||||||
          :min_part_hours => '2'
 | 
					          :min_part_hours => '2'
 | 
				
			||||||
@@ -75,22 +75,22 @@ describe 'swift::ringbuilder' do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it 'should set up all of the correct dependencies' do
 | 
					      it 'should set up all of the correct dependencies' do
 | 
				
			||||||
        should contain_swift__ringbuilder__create('object').with(
 | 
					        is_expected.to contain_swift__ringbuilder__create('object').with(
 | 
				
			||||||
          {:before => 'Ring_object_device[127.0.0.1:6000/1]'}
 | 
					          {:before => 'Ring_object_device[127.0.0.1:6000/1]'}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_swift__ringbuilder__create('container').with(
 | 
					        is_expected.to contain_swift__ringbuilder__create('container').with(
 | 
				
			||||||
        {:before => 'Ring_container_device[127.0.0.1:6001/1]'}
 | 
					        {:before => 'Ring_container_device[127.0.0.1:6001/1]'}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_swift__ringbuilder__create('account').with(
 | 
					        is_expected.to contain_swift__ringbuilder__create('account').with(
 | 
				
			||||||
        {:before => 'Ring_account_device[127.0.0.1:6002/1]'}
 | 
					        {:before => 'Ring_account_device[127.0.0.1:6002/1]'}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_ring_object_device('127.0.0.1:6000/1').with(
 | 
					        is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with(
 | 
				
			||||||
        {:notify => 'Swift::Ringbuilder::Rebalance[object]'}
 | 
					        {:notify => 'Swift::Ringbuilder::Rebalance[object]'}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_ring_container_device('127.0.0.1:6001/1').with(
 | 
					        is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with(
 | 
				
			||||||
        {:notify => 'Swift::Ringbuilder::Rebalance[container]'}
 | 
					        {:notify => 'Swift::Ringbuilder::Rebalance[container]'}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_ring_account_device('127.0.0.1:6002/1').with(
 | 
					        is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with(
 | 
				
			||||||
        {:notify => 'Swift::Ringbuilder::Rebalance[account]'}
 | 
					        {:notify => 'Swift::Ringbuilder::Rebalance[account]'}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,11 +25,11 @@ describe 'swift::ringserver' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'does not create the rsync::server class' do
 | 
					    it 'does not create the rsync::server class' do
 | 
				
			||||||
      should compile
 | 
					      is_expected.to compile
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'contain the swift_server rsync block' do
 | 
					    it 'contain the swift_server rsync block' do
 | 
				
			||||||
      should contain_rsync__server__module('swift_server').with({
 | 
					      is_expected.to contain_rsync__server__module('swift_server').with({
 | 
				
			||||||
        'path'            => '/etc/swift',
 | 
					        'path'            => '/etc/swift',
 | 
				
			||||||
        'lock_file'       => '/var/lock/swift_server.lock',
 | 
					        'lock_file'       => '/var/lock/swift_server.lock',
 | 
				
			||||||
        'uid'             => 'swift',
 | 
					        'uid'             => 'swift',
 | 
				
			||||||
@@ -64,7 +64,7 @@ describe 'swift::ringserver' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'does create the rsync::server class' do
 | 
					    it 'does create the rsync::server class' do
 | 
				
			||||||
      should contain_class('rsync::server').with({
 | 
					      is_expected.to contain_class('rsync::server').with({
 | 
				
			||||||
        'use_xinetd' => 'true',
 | 
					        'use_xinetd' => 'true',
 | 
				
			||||||
        'address'    => '127.0.0.1',
 | 
					        'address'    => '127.0.0.1',
 | 
				
			||||||
        'use_chroot' => 'no'
 | 
					        'use_chroot' => 'no'
 | 
				
			||||||
@@ -72,7 +72,7 @@ describe 'swift::ringserver' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'contain the swift_server rsync block' do
 | 
					    it 'contain the swift_server rsync block' do
 | 
				
			||||||
      should contain_rsync__server__module('swift_server').with({
 | 
					      is_expected.to contain_rsync__server__module('swift_server').with({
 | 
				
			||||||
        'path'            => '/etc/swift',
 | 
					        'path'            => '/etc/swift',
 | 
				
			||||||
        'lock_file'       => '/var/lock/swift_server.lock',
 | 
					        'lock_file'       => '/var/lock/swift_server.lock',
 | 
				
			||||||
        'uid'             => 'swift',
 | 
					        'uid'             => 'swift',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@ describe 'swift' do
 | 
				
			|||||||
      {}
 | 
					      {}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should raise an exception' do
 | 
					    it 'should raise an exception' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,46 +31,45 @@ describe 'swift' do
 | 
				
			|||||||
        :require => 'Package[swift]'
 | 
					        :require => 'Package[swift]'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it {should contain_user('swift')}
 | 
					    it {is_expected.to contain_user('swift')}
 | 
				
			||||||
    it {should contain_file('/home/swift').with(
 | 
					    it {is_expected.to contain_file('/home/swift').with(
 | 
				
			||||||
      {:ensure => 'directory', :mode => '0700'
 | 
					      {:ensure => 'directory', :mode => '0700'
 | 
				
			||||||
      }.merge(file_defaults)
 | 
					      }.merge(file_defaults)
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
    it {should contain_file('/etc/swift').with(
 | 
					    it {is_expected.to contain_file('/etc/swift').with(
 | 
				
			||||||
      {:ensure => 'directory', :mode => '2770'
 | 
					      {:ensure => 'directory', :mode => '2770'
 | 
				
			||||||
      }.merge(file_defaults)
 | 
					      }.merge(file_defaults)
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
    it {should contain_file('/var/run/swift').with(
 | 
					    it {is_expected.to contain_file('/var/run/swift').with(
 | 
				
			||||||
      {:ensure => 'directory'}.merge(file_defaults)
 | 
					      {:ensure => 'directory'}.merge(file_defaults)
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
    it {should contain_file('/var/lib/swift').with(
 | 
					    it {is_expected.to contain_file('/var/lib/swift').with(
 | 
				
			||||||
      {:ensure => 'directory'}.merge(file_defaults)
 | 
					      {:ensure => 'directory'}.merge(file_defaults)
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
    it {should contain_file('/etc/swift/swift.conf').with(
 | 
					    it {is_expected.to contain_file('/etc/swift/swift.conf').with(
 | 
				
			||||||
      {:ensure  => 'present',
 | 
					      {:ensure  => 'present',
 | 
				
			||||||
       :mode    => '0660',
 | 
					       :mode    => '0660',
 | 
				
			||||||
      }.merge(file_defaults)
 | 
					      }.merge(file_defaults)
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
    it 'configures swift.conf' do
 | 
					    it 'configures swift.conf' do
 | 
				
			||||||
      should contain_swift_config(
 | 
					      is_expected.to contain_swift_config(
 | 
				
			||||||
        'swift-hash/swift_hash_path_suffix').with_value('string')
 | 
					        'swift-hash/swift_hash_path_suffix').with_value('string')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it {should contain_package('swift').with_ensure('present')}
 | 
					    it { is_expected.to contain_package('swift').with_ensure('present') }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'when overriding package_ensure parameter' do
 | 
					  describe 'when overriding package_ensure parameter' do
 | 
				
			||||||
    it 'should effect ensure state of swift package' do
 | 
					    it 'should effect ensure state of swift package' do
 | 
				
			||||||
      params[:package_ensure] = '1.12.0-1'
 | 
					      params[:package_ensure] = '1.12.0-1'
 | 
				
			||||||
      subject.should contain_package('swift').with_ensure(params[:package_ensure])
 | 
					      is_expected.to contain_package('swift').with_ensure(params[:package_ensure])
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'when overriding client_package_ensure parameter' do
 | 
					  describe 'when overriding client_package_ensure parameter' do
 | 
				
			||||||
    it 'should effect ensure state of swift package' do
 | 
					    it 'should effect ensure state of swift package' do
 | 
				
			||||||
      params[:client_package_ensure] = '2.0.2-1'
 | 
					      params[:client_package_ensure] = '2.0.2-1'
 | 
				
			||||||
      subject.should contain_package('swiftclient').with_ensure(params[:client_package_ensure])
 | 
					      is_expected.to contain_package('swiftclient').with_ensure(params[:client_package_ensure])
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,20 +23,20 @@ describe 'swift::storage::account' do
 | 
				
			|||||||
          params.merge!(param_set)
 | 
					          params.merge!(param_set)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it { should contain_swift__storage__generic('account').with_package_ensure(params[:package_ensure]) }
 | 
					        it { is_expected.to contain_swift__storage__generic('account').with_package_ensure(params[:package_ensure]) }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [{ :enabled => true, :manage_service => true },
 | 
					    [{ :enabled => true, :manage_service => true },
 | 
				
			||||||
     { :enabled => false, :manage_service => true }].each do |param_hash|
 | 
					     { :enabled => false, :manage_service => true }].each do |param_hash|
 | 
				
			||||||
      context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
 | 
					      context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
 | 
				
			||||||
        before do
 | 
					        before do
 | 
				
			||||||
          params.merge!(param_hash)
 | 
					          params.merge!(param_hash)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it 'configures services' do
 | 
					        it 'configures services' do
 | 
				
			||||||
          platform_params[:service_names].each do |service_alias, service_name|
 | 
					          platform_params[:service_names].each do |service_alias, service_name|
 | 
				
			||||||
            should contain_service(service_alias).with(
 | 
					            is_expected.to contain_service(service_alias).with(
 | 
				
			||||||
              :name    => service_name,
 | 
					              :name    => service_name,
 | 
				
			||||||
              :ensure  => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
					              :ensure  => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
				
			||||||
              :enable  => param_hash[:enabled]
 | 
					              :enable  => param_hash[:enabled]
 | 
				
			||||||
@@ -55,7 +55,7 @@ describe 'swift::storage::account' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      it 'configures services' do
 | 
					      it 'configures services' do
 | 
				
			||||||
        platform_params[:service_names].each do |service_alias, service_name|
 | 
					        platform_params[:service_names].each do |service_alias, service_name|
 | 
				
			||||||
          should contain_service(service_alias).with(
 | 
					          is_expected.to contain_service(service_alias).with(
 | 
				
			||||||
            :ensure    => nil,
 | 
					            :ensure    => nil,
 | 
				
			||||||
            :name      => service_name,
 | 
					            :name      => service_name,
 | 
				
			||||||
            :enable    => false
 | 
					            :enable    => false
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,7 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'when an internal network ip is not specified' do
 | 
					  describe 'when an internal network ip is not specified' do
 | 
				
			||||||
    it 'should fail' do
 | 
					    it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/)
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [{  :storage_local_net_ip => '127.0.0.1' },
 | 
					  [{  :storage_local_net_ip => '127.0.0.1' },
 | 
				
			||||||
@@ -57,21 +55,21 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ['object', 'container', 'account'].each do |type|
 | 
					      ['object', 'container', 'account'].each do |type|
 | 
				
			||||||
        it { should contain_package("swift-#{type}").with_ensure('present') }
 | 
					        it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
 | 
				
			||||||
        it { should contain_service("swift-#{type}").with(
 | 
					        it { is_expected.to contain_service("swift-#{type}").with(
 | 
				
			||||||
          {:provider  => 'upstart',
 | 
					          {:provider  => 'upstart',
 | 
				
			||||||
           :ensure    => 'running',
 | 
					           :ensure    => 'running',
 | 
				
			||||||
           :enable    => true,
 | 
					           :enable    => true,
 | 
				
			||||||
           :hasstatus => true
 | 
					           :hasstatus => true
 | 
				
			||||||
          })}
 | 
					          })}
 | 
				
			||||||
        it { should contain_service("swift-#{type}-replicator").with(
 | 
					        it { is_expected.to contain_service("swift-#{type}-replicator").with(
 | 
				
			||||||
          {:provider  => 'upstart',
 | 
					          {:provider  => 'upstart',
 | 
				
			||||||
           :ensure    => 'running',
 | 
					           :ensure    => 'running',
 | 
				
			||||||
           :enable    => true,
 | 
					           :enable    => true,
 | 
				
			||||||
           :hasstatus => true
 | 
					           :hasstatus => true
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
        it { should contain_file("/etc/swift/#{type}-server/").with(
 | 
					        it { is_expected.to contain_file("/etc/swift/#{type}-server/").with(
 | 
				
			||||||
          {:ensure => 'directory',
 | 
					          {:ensure => 'directory',
 | 
				
			||||||
           :owner  => 'swift',
 | 
					           :owner  => 'swift',
 | 
				
			||||||
           :group  => 'swift'}
 | 
					           :group  => 'swift'}
 | 
				
			||||||
@@ -85,24 +83,24 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should contain_swift__storage__server(param_hash[:account_port]).with(
 | 
					      it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with(
 | 
				
			||||||
        {:type => 'account',
 | 
					        {:type => 'account',
 | 
				
			||||||
         :config_file_path => 'account-server.conf',
 | 
					         :config_file_path => 'account-server.conf',
 | 
				
			||||||
         :pipeline => param_hash[:account_pipeline] || 'account-server' }.merge(storage_server_defaults)
 | 
					         :pipeline => param_hash[:account_pipeline] || 'account-server' }.merge(storage_server_defaults)
 | 
				
			||||||
      )}
 | 
					      )}
 | 
				
			||||||
      it { should contain_swift__storage__server(param_hash[:object_port]).with(
 | 
					      it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with(
 | 
				
			||||||
        {:type => 'object',
 | 
					        {:type => 'object',
 | 
				
			||||||
         :config_file_path => 'object-server.conf',
 | 
					         :config_file_path => 'object-server.conf',
 | 
				
			||||||
         :pipeline => param_hash[:object_pipeline] || 'object-server' }.merge(storage_server_defaults)
 | 
					         :pipeline => param_hash[:object_pipeline] || 'object-server' }.merge(storage_server_defaults)
 | 
				
			||||||
      )}
 | 
					      )}
 | 
				
			||||||
      it { should contain_swift__storage__server(param_hash[:container_port]).with(
 | 
					      it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
 | 
				
			||||||
        {:type => 'container',
 | 
					        {:type => 'container',
 | 
				
			||||||
         :config_file_path => 'container-server.conf',
 | 
					         :config_file_path => 'container-server.conf',
 | 
				
			||||||
         :pipeline => param_hash[:container_pipeline] || 'container-server',
 | 
					         :pipeline => param_hash[:container_pipeline] || 'container-server',
 | 
				
			||||||
         :allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults)
 | 
					         :allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults)
 | 
				
			||||||
      )}
 | 
					      )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should contain_class('rsync::server').with(
 | 
					      it { is_expected.to contain_class('rsync::server').with(
 | 
				
			||||||
        {:use_xinetd => true,
 | 
					        {:use_xinetd => true,
 | 
				
			||||||
         :address    => param_hash[:storage_local_net_ip],
 | 
					         :address    => param_hash[:storage_local_net_ip],
 | 
				
			||||||
         :use_chroot => 'no'
 | 
					         :use_chroot => 'no'
 | 
				
			||||||
@@ -138,14 +136,14 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
          param_set
 | 
					          param_set
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        ['object', 'container', 'account'].each do |type|
 | 
					        ['object', 'container', 'account'].each do |type|
 | 
				
			||||||
          it { should contain_package("swift-#{type}").with_ensure('present') }
 | 
					          it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
 | 
				
			||||||
          it { should contain_service("swift-#{type}").with(
 | 
					          it { is_expected.to contain_service("swift-#{type}").with(
 | 
				
			||||||
            {:provider  => nil,
 | 
					            {:provider  => nil,
 | 
				
			||||||
              :ensure    => 'running',
 | 
					              :ensure    => 'running',
 | 
				
			||||||
              :enable    => true,
 | 
					              :enable    => true,
 | 
				
			||||||
              :hasstatus => true
 | 
					              :hasstatus => true
 | 
				
			||||||
            })}
 | 
					            })}
 | 
				
			||||||
            it { should contain_service("swift-#{type}-replicator").with(
 | 
					            it { is_expected.to contain_service("swift-#{type}-replicator").with(
 | 
				
			||||||
              {:provider  => nil,
 | 
					              {:provider  => nil,
 | 
				
			||||||
                :ensure    => 'running',
 | 
					                :ensure    => 'running',
 | 
				
			||||||
                :enable    => true,
 | 
					                :enable    => true,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,21 +22,21 @@ describe 'swift::storage::container' do
 | 
				
			|||||||
          params.merge!(param_set)
 | 
					          params.merge!(param_set)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it { should contain_swift__storage__generic('container').with_package_ensure(params[:package_ensure]) }
 | 
					        it { is_expected.to contain_swift__storage__generic('container').with_package_ensure(params[:package_ensure]) }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [{ :enabled => true, :manage_service => true },
 | 
					    [{ :enabled => true, :manage_service => true },
 | 
				
			||||||
     { :enabled => false, :manage_service => true }].each do |param_hash|
 | 
					     { :enabled => false, :manage_service => true }].each do |param_hash|
 | 
				
			||||||
      context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
 | 
					      context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
 | 
				
			||||||
        before do
 | 
					        before do
 | 
				
			||||||
          params.merge!(param_hash)
 | 
					          params.merge!(param_hash)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it 'configures services' do
 | 
					        it 'configures services' do
 | 
				
			||||||
          platform_params[:service_names].each do |service_alias, service_name|
 | 
					          platform_params[:service_names].each do |service_alias, service_name|
 | 
				
			||||||
            should contain_service(service_alias).with(
 | 
					            is_expected.to contain_service(service_alias).with(
 | 
				
			||||||
              :name    => service_name,
 | 
					              :name    => service_name,
 | 
				
			||||||
              :ensure  => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
					              :ensure  => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
				
			||||||
              :enable  => param_hash[:enabled]
 | 
					              :enable  => param_hash[:enabled]
 | 
				
			||||||
@@ -55,7 +55,7 @@ describe 'swift::storage::container' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      it 'configures services' do
 | 
					      it 'configures services' do
 | 
				
			||||||
        platform_params[:service_names].each do |service_alias, service_name|
 | 
					        platform_params[:service_names].each do |service_alias, service_name|
 | 
				
			||||||
          should contain_service(service_alias).with(
 | 
					          is_expected.to contain_service(service_alias).with(
 | 
				
			||||||
            :ensure    => nil,
 | 
					            :ensure    => nil,
 | 
				
			||||||
            :name      => service_name,
 | 
					            :name      => service_name,
 | 
				
			||||||
            :enable    => false
 | 
					            :enable    => false
 | 
				
			||||||
@@ -86,17 +86,17 @@ describe 'swift::storage::container' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    context 'Ubuntu specific resources' do
 | 
					    context 'Ubuntu specific resources' do
 | 
				
			||||||
      it 'configures sync' do
 | 
					      it 'configures sync' do
 | 
				
			||||||
        should contain_service('swift-container-sync').with(
 | 
					        is_expected.to contain_service('swift-container-sync').with(
 | 
				
			||||||
          :ensure   => 'running',
 | 
					          :ensure   => 'running',
 | 
				
			||||||
          :enable   => true,
 | 
					          :enable   => true,
 | 
				
			||||||
          :provider => 'upstart',
 | 
					          :provider => 'upstart',
 | 
				
			||||||
          :require  => ['File[/etc/init/swift-container-sync.conf]', 'File[/etc/init.d/swift-container-sync]']
 | 
					          :require  => ['File[/etc/init/swift-container-sync.conf]', 'File[/etc/init.d/swift-container-sync]']
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_file('/etc/init/swift-container-sync.conf').with(
 | 
					        is_expected.to contain_file('/etc/init/swift-container-sync.conf').with(
 | 
				
			||||||
          :source  => 'puppet:///modules/swift/swift-container-sync.conf.upstart',
 | 
					          :source  => 'puppet:///modules/swift/swift-container-sync.conf.upstart',
 | 
				
			||||||
          :require => 'Package[swift-container]'
 | 
					          :require => 'Package[swift-container]'
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        should contain_file('/etc/init.d/swift-container-sync').with(
 | 
					        is_expected.to contain_file('/etc/init.d/swift-container-sync').with(
 | 
				
			||||||
          :ensure => 'link',
 | 
					          :ensure => 'link',
 | 
				
			||||||
          :target => '/lib/init/upstart-job'
 | 
					          :target => '/lib/init/upstart-job'
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
@@ -138,7 +138,7 @@ describe 'swift::storage::container' do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it {
 | 
					      it {
 | 
				
			||||||
        should contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/)
 | 
					        is_expected.to contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ describe 'swift::storage::object' do
 | 
				
			|||||||
          params.merge!(param_set)
 | 
					          params.merge!(param_set)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it { should contain_swift__storage__generic('object').with_package_ensure(params[:package_ensure]) }
 | 
					        it { is_expected.to contain_swift__storage__generic('object').with_package_ensure(params[:package_ensure]) }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -37,7 +37,7 @@ describe 'swift::storage::object' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        it 'configures services' do
 | 
					        it 'configures services' do
 | 
				
			||||||
          platform_params[:service_names].each do |service_alias, service_name|
 | 
					          platform_params[:service_names].each do |service_alias, service_name|
 | 
				
			||||||
            should contain_service(service_alias).with(
 | 
					            is_expected.to contain_service(service_alias).with(
 | 
				
			||||||
              :name    => service_name,
 | 
					              :name    => service_name,
 | 
				
			||||||
              :ensure  => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
					              :ensure  => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
 | 
				
			||||||
              :enable  => param_hash[:enabled]
 | 
					              :enable  => param_hash[:enabled]
 | 
				
			||||||
@@ -56,7 +56,7 @@ describe 'swift::storage::object' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      it 'configures services' do
 | 
					      it 'configures services' do
 | 
				
			||||||
        platform_params[:service_names].each do |service_alias, service_name|
 | 
					        platform_params[:service_names].each do |service_alias, service_name|
 | 
				
			||||||
          should contain_service(service_alias).with(
 | 
					          is_expected.to contain_service(service_alias).with(
 | 
				
			||||||
            :ensure    => nil,
 | 
					            :ensure    => nil,
 | 
				
			||||||
            :name      => service_name,
 | 
					            :name      => service_name,
 | 
				
			||||||
            :enable    => false
 | 
					            :enable    => false
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ describe 'swift::storage' do
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should contain_class('rsync::server').with(
 | 
					      it { is_expected.to contain_class('rsync::server').with(
 | 
				
			||||||
        {:use_xinetd => true,
 | 
					        {:use_xinetd => true,
 | 
				
			||||||
         :address    => params[:storage_local_net_ip],
 | 
					         :address    => params[:storage_local_net_ip],
 | 
				
			||||||
         :use_chroot => 'no'
 | 
					         :use_chroot => 'no'
 | 
				
			||||||
@@ -32,14 +32,12 @@ describe 'swift::storage' do
 | 
				
			|||||||
      )}
 | 
					      )}
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    describe 'when local net ip is not specified' do
 | 
					    describe 'when local net ip is not specified' do
 | 
				
			||||||
      it 'should fail' do
 | 
					      it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
 | 
				
			||||||
        expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/)
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  describe 'when the dependencies are not specified' do
 | 
					  describe 'when the dependencies are not specified' do
 | 
				
			||||||
    it 'should fail' do
 | 
					    it 'should fail' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ describe 'swift::test_file' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should create a reasonable test file' do
 | 
					    it 'should create a reasonable test file' do
 | 
				
			||||||
      verify_contents(subject, '/tmp/swift_test_file.rb',
 | 
					      verify_contents(catalogue, '/tmp/swift_test_file.rb',
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          'proxy_local_net_ip="127.0.0.1"',
 | 
					          'proxy_local_net_ip="127.0.0.1"',
 | 
				
			||||||
          "user='openstack:admin'",
 | 
					          "user='openstack:admin'",
 | 
				
			||||||
@@ -36,7 +36,7 @@ describe 'swift::test_file' do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should create a configured test file' do
 | 
					    it 'should create a configured test file' do
 | 
				
			||||||
      verify_contents(subject, '/tmp/swift_test_file.rb',
 | 
					      verify_contents(catalogue, '/tmp/swift_test_file.rb',
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          'proxy_local_net_ip="127.0.0.2"',
 | 
					          'proxy_local_net_ip="127.0.0.2"',
 | 
				
			||||||
          "user='tenant:user'",
 | 
					          "user='tenant:user'",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
require 'spec_helper'
 | 
					require 'spec_helper'
 | 
				
			||||||
describe 'swift::xfs' do
 | 
					describe 'swift::xfs' do
 | 
				
			||||||
  ['xfsprogs', 'parted'].each do |present_package|
 | 
					  ['xfsprogs', 'parted'].each do |present_package|
 | 
				
			||||||
    it { should contain_package(present_package).with_ensure('present') }
 | 
					    it { is_expected.to contain_package(present_package).with_ensure('present') }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ describe 'swift::ringbuilder::create' do
 | 
				
			|||||||
              param_set
 | 
					              param_set
 | 
				
			||||||
            end
 | 
					            end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it { should contain_exec("create_#{type}").with(
 | 
					            it { is_expected.to contain_exec("create_#{type}").with(
 | 
				
			||||||
              {:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
 | 
					              {:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
 | 
				
			||||||
               :path    => '/usr/bin',
 | 
					               :path    => '/usr/bin',
 | 
				
			||||||
               :creates => "/etc/swift/#{type}.builder" }
 | 
					               :creates => "/etc/swift/#{type}.builder" }
 | 
				
			||||||
@@ -44,7 +44,7 @@ describe 'swift::ringbuilder::create' do
 | 
				
			|||||||
      'invalid'
 | 
					      'invalid'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should raise an error' do
 | 
					    it 'should raise an error' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ describe 'swift::ringbuilder::rebalance' do
 | 
				
			|||||||
        let :title do
 | 
					        let :title do
 | 
				
			||||||
          type
 | 
					          type
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        it { should contain_exec("rebalance_#{type}").with(
 | 
					        it { is_expected.to contain_exec("rebalance_#{type}").with(
 | 
				
			||||||
          {:command     => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
 | 
					          {:command     => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
 | 
				
			||||||
           :path        => '/usr/bin',
 | 
					           :path        => '/usr/bin',
 | 
				
			||||||
           :refreshonly => true}
 | 
					           :refreshonly => true}
 | 
				
			||||||
@@ -21,7 +21,7 @@ describe 'swift::ringbuilder::rebalance' do
 | 
				
			|||||||
    let :title do
 | 
					    let :title do
 | 
				
			||||||
      'object'
 | 
					      'object'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it { should contain_exec("rebalance_object").with(
 | 
					    it { is_expected.to contain_exec("rebalance_object").with(
 | 
				
			||||||
      {:command     => "swift-ring-builder /etc/swift/object.builder rebalance 999",
 | 
					      {:command     => "swift-ring-builder /etc/swift/object.builder rebalance 999",
 | 
				
			||||||
       :path        => '/usr/bin',
 | 
					       :path        => '/usr/bin',
 | 
				
			||||||
       :refreshonly => true}
 | 
					       :refreshonly => true}
 | 
				
			||||||
@@ -35,7 +35,7 @@ describe 'swift::ringbuilder::rebalance' do
 | 
				
			|||||||
      { :seed => 'invalid' }
 | 
					      { :seed => 'invalid' }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should raise an error' do
 | 
					    it 'should raise an error' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  describe 'with an invalid title' do
 | 
					  describe 'with an invalid title' do
 | 
				
			||||||
@@ -43,7 +43,7 @@ describe 'swift::ringbuilder::rebalance' do
 | 
				
			|||||||
      'invalid'
 | 
					      'invalid'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should raise an error' do
 | 
					    it 'should raise an error' do
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error)
 | 
					      expect { catalogue }.to raise_error(Puppet::Error)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ describe 'swift::storage::disk' do
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_swift__storage__xfs('sdb').with(
 | 
					  it { is_expected.to contain_swift__storage__xfs('sdb').with(
 | 
				
			||||||
    :device       => '/dev/sdb',
 | 
					    :device       => '/dev/sdb',
 | 
				
			||||||
    :mnt_base_dir => '/srv/node',
 | 
					    :mnt_base_dir => '/srv/node',
 | 
				
			||||||
    :byte_size    => '1024',
 | 
					    :byte_size    => '1024',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ describe 'swift::storage::filter::healthcheck' do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it 'should build the fragment with correct content' do
 | 
					it 'should build the fragment with correct content' do
 | 
				
			||||||
  verify_contents(subject, fragment_file,
 | 
					  verify_contents(catalogue, fragment_file,
 | 
				
			||||||
    [
 | 
					    [
 | 
				
			||||||
      '[filter:healthcheck]',
 | 
					      '[filter:healthcheck]',
 | 
				
			||||||
      'use = egg:swift#healthcheck'
 | 
					      'use = egg:swift#healthcheck'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ describe 'swift::storage::filter::recon' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe 'when passing default parameters' do
 | 
					  describe 'when passing default parameters' do
 | 
				
			||||||
    it 'should build the fragment with correct content' do
 | 
					    it 'should build the fragment with correct content' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:recon]',
 | 
					          '[filter:recon]',
 | 
				
			||||||
          'use = egg:swift#recon',
 | 
					          'use = egg:swift#recon',
 | 
				
			||||||
@@ -37,7 +37,7 @@ describe 'swift::storage::filter::recon' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should build the fragment with correct content' do
 | 
					    it 'should build the fragment with correct content' do
 | 
				
			||||||
      verify_contents(subject, fragment_file,
 | 
					      verify_contents(catalogue, fragment_file,
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
          '[filter:recon]',
 | 
					          '[filter:recon]',
 | 
				
			||||||
          'use = egg:swift#recon',
 | 
					          'use = egg:swift#recon',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,9 +28,7 @@ describe 'swift::storage::generic' do
 | 
				
			|||||||
    let :title do
 | 
					    let :title do
 | 
				
			||||||
      'foo'
 | 
					      'foo'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should fail' do
 | 
					    it_raises 'a Puppet::Error', /does not match/
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error, /does not match/)
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ['account', 'object', 'container'].each do |t|
 | 
					  ['account', 'object', 'container'].each do |t|
 | 
				
			||||||
@@ -48,20 +46,20 @@ describe 'swift::storage::generic' do
 | 
				
			|||||||
        let :params do
 | 
					        let :params do
 | 
				
			||||||
          param_set
 | 
					          param_set
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        it { should contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) }
 | 
					        it { is_expected.to contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) }
 | 
				
			||||||
        it { should contain_service("swift-#{t}").with(
 | 
					        it { is_expected.to contain_service("swift-#{t}").with(
 | 
				
			||||||
          :ensure    => 'running',
 | 
					          :ensure    => 'running',
 | 
				
			||||||
          :enable    => true,
 | 
					          :enable    => true,
 | 
				
			||||||
          :hasstatus => true,
 | 
					          :hasstatus => true,
 | 
				
			||||||
          :provider  => param_hash[:service_provider]
 | 
					          :provider  => param_hash[:service_provider]
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
        it { should contain_service("swift-#{t}-replicator").with(
 | 
					        it { is_expected.to contain_service("swift-#{t}-replicator").with(
 | 
				
			||||||
          :ensure    => 'running',
 | 
					          :ensure    => 'running',
 | 
				
			||||||
          :enable    => true,
 | 
					          :enable    => true,
 | 
				
			||||||
          :hasstatus => true,
 | 
					          :hasstatus => true,
 | 
				
			||||||
          :provider  => param_hash[:service_provider]
 | 
					          :provider  => param_hash[:service_provider]
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
        it { should contain_file("/etc/swift/#{t}-server/").with(
 | 
					        it { is_expected.to contain_file("/etc/swift/#{t}-server/").with(
 | 
				
			||||||
          :ensure => 'directory',
 | 
					          :ensure => 'directory',
 | 
				
			||||||
          :owner  => 'swift',
 | 
					          :owner  => 'swift',
 | 
				
			||||||
          :group  => 'swift'
 | 
					          :group  => 'swift'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ describe 'swift::storage::loopback' do
 | 
				
			|||||||
    'dans_disk'
 | 
					    'dans_disk'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it { should contain_swift__storage__xfs('dans_disk').with(
 | 
					  it { is_expected.to contain_swift__storage__xfs('dans_disk').with(
 | 
				
			||||||
    :device       => '/srv/loopback-device/dans_disk',
 | 
					    :device       => '/srv/loopback-device/dans_disk',
 | 
				
			||||||
    :mnt_base_dir => '/srv/node',
 | 
					    :mnt_base_dir => '/srv/node',
 | 
				
			||||||
    :byte_size    => '1024',
 | 
					    :byte_size    => '1024',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ describe 'swift::storage::mount' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_mount('/srv/node/dans_mount_point').with(
 | 
					    it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
 | 
				
			||||||
      :ensure  => 'present',
 | 
					      :ensure  => 'present',
 | 
				
			||||||
      :device  => '/dev/sda',
 | 
					      :device  => '/dev/sda',
 | 
				
			||||||
      :fstype  => 'xfs',
 | 
					      :fstype  => 'xfs',
 | 
				
			||||||
@@ -32,7 +32,7 @@ describe 'swift::storage::mount' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_mount('/srv/node/dans_mount_point').with(
 | 
					    it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
 | 
				
			||||||
      :device  => '/dev/sda',
 | 
					      :device  => '/dev/sda',
 | 
				
			||||||
      :options => 'noatime,nodiratime,nobarrier,loop,logbufs=8'
 | 
					      :options => 'noatime,nodiratime,nobarrier,loop,logbufs=8'
 | 
				
			||||||
    )}
 | 
					    )}
 | 
				
			||||||
@@ -52,7 +52,7 @@ describe 'swift::storage::mount' do
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it { should contain_exec("restorecon_mount_dans_mount_point").with(
 | 
					    it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
 | 
				
			||||||
      {:command     => "restorecon /srv/node/dans_mount_point",
 | 
					      {:command     => "restorecon /srv/node/dans_mount_point",
 | 
				
			||||||
       :path        => ['/usr/sbin', '/sbin'],
 | 
					       :path        => ['/usr/sbin', '/sbin'],
 | 
				
			||||||
       :refreshonly => true}
 | 
					       :refreshonly => true}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,9 +26,9 @@ describe 'swift::storage::node' do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it {
 | 
					  it {
 | 
				
			||||||
    should contain_ring_object_device("127.0.0.1:6010/1")
 | 
					    is_expected.to contain_ring_object_device("127.0.0.1:6010/1")
 | 
				
			||||||
    should contain_ring_container_device("127.0.0.1:6011/1")
 | 
					    is_expected.to contain_ring_container_device("127.0.0.1:6011/1")
 | 
				
			||||||
    should contain_ring_account_device("127.0.0.1:6012/1")
 | 
					    is_expected.to contain_ring_account_device("127.0.0.1:6012/1")
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  context 'when zone is not a number' do
 | 
					  context 'when zone is not a number' do
 | 
				
			||||||
@@ -38,10 +38,6 @@ describe 'swift::storage::node' do
 | 
				
			|||||||
       :mnt_base_dir => '/srv/node' }
 | 
					       :mnt_base_dir => '/srv/node' }
 | 
				
			||||||
     end
 | 
					     end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'should raise an error' do
 | 
					    it_raises 'a Puppet::Error', /The zone parameter must be an integer/
 | 
				
			||||||
      expect {
 | 
					 | 
				
			||||||
        subject
 | 
					 | 
				
			||||||
      }.to raise_error(Puppet::Error, /The zone parameter must be an integer/)
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,9 +34,7 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
    let :title do
 | 
					    let :title do
 | 
				
			||||||
      'foo'
 | 
					      'foo'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    it 'should fail' do
 | 
					    it_raises 'a Puppet::Error', /does not match/
 | 
				
			||||||
      expect { subject }.to raise_error(Puppet::Error, /does not match/)
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ['account', 'object', 'container'].each do |t|
 | 
					  ['account', 'object', 'container'].each do |t|
 | 
				
			||||||
@@ -54,8 +52,8 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
        req_params
 | 
					        req_params
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it { should contain_package("swift-#{t}").with_ensure('present') }
 | 
					      it { is_expected.to contain_package("swift-#{t}").with_ensure('present') }
 | 
				
			||||||
      it { should contain_service("swift-#{t}").with(
 | 
					      it { is_expected.to contain_service("swift-#{t}").with(
 | 
				
			||||||
        :ensure    => 'running',
 | 
					        :ensure    => 'running',
 | 
				
			||||||
        :enable    => true,
 | 
					        :enable    => true,
 | 
				
			||||||
        :hasstatus => true
 | 
					        :hasstatus => true
 | 
				
			||||||
@@ -74,7 +72,7 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
        }.each do |k,v|
 | 
					        }.each do |k,v|
 | 
				
			||||||
          describe "when #{k} is set" do
 | 
					          describe "when #{k} is set" do
 | 
				
			||||||
            let :params do req_params.merge({k => v}) end
 | 
					            let :params do req_params.merge({k => v}) end
 | 
				
			||||||
            it { should contain_file(fragment_file) \
 | 
					            it { is_expected.to contain_file(fragment_file) \
 | 
				
			||||||
              .with_content(
 | 
					              .with_content(
 | 
				
			||||||
                /^#{k.to_s}\s*=\s*#{v.is_a?(Array) ? v.join(' ') : v}\s*$/
 | 
					                /^#{k.to_s}\s*=\s*#{v.is_a?(Array) ? v.join(' ') : v}\s*$/
 | 
				
			||||||
              )
 | 
					              )
 | 
				
			||||||
@@ -83,35 +81,33 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
        end
 | 
					        end
 | 
				
			||||||
        describe "when pipeline is passed an array" do
 | 
					        describe "when pipeline is passed an array" do
 | 
				
			||||||
          let :params do req_params.merge({:pipeline => ['healthcheck','recon','test']})  end
 | 
					          let :params do req_params.merge({:pipeline => ['healthcheck','recon','test']})  end
 | 
				
			||||||
          it { should contain_concat__fragment("swift-#{t}-#{title}").with(
 | 
					          it { is_expected.to contain_concat__fragment("swift-#{t}-#{title}").with(
 | 
				
			||||||
            :content => /^pipeline\s*=\s*healthcheck recon test\s*$/,
 | 
					            :content => /^pipeline\s*=\s*healthcheck recon test\s*$/,
 | 
				
			||||||
            :before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]", "Swift::Storage::Filter::Test[#{t}]"]
 | 
					            :before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]", "Swift::Storage::Filter::Test[#{t}]"]
 | 
				
			||||||
          )}
 | 
					          )}
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        describe "when pipeline is not passed an array" do
 | 
					        describe "when pipeline is not passed an array" do
 | 
				
			||||||
          let :params do req_params.merge({:pipeline => 'not an array'}) end
 | 
					          let :params do req_params.merge({:pipeline => 'not an array'}) end
 | 
				
			||||||
          it "should fail" do
 | 
					          it_raises 'a Puppet::Error', /is not an Array/
 | 
				
			||||||
            expect { subject }.to raise_error(Puppet::Error, /is not an Array/)
 | 
					 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        describe "when replicator_concurrency is set" do
 | 
					        describe "when replicator_concurrency is set" do
 | 
				
			||||||
          let :params do req_params.merge({:replicator_concurrency => 42}) end
 | 
					          let :params do req_params.merge({:replicator_concurrency => 42}) end
 | 
				
			||||||
          it { should contain_file(fragment_file) \
 | 
					          it { is_expected.to contain_file(fragment_file) \
 | 
				
			||||||
            .with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m)
 | 
					            .with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        if t != 'account'
 | 
					        if t != 'account'
 | 
				
			||||||
          describe "when updater_concurrency is set" do
 | 
					          describe "when updater_concurrency is set" do
 | 
				
			||||||
            let :params do req_params.merge({:updater_concurrency => 73}) end
 | 
					            let :params do req_params.merge({:updater_concurrency => 73}) end
 | 
				
			||||||
            it { should contain_file(fragment_file) \
 | 
					            it { is_expected.to contain_file(fragment_file) \
 | 
				
			||||||
              .with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m)
 | 
					              .with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          describe "when reaper_concurrency is set" do
 | 
					          describe "when reaper_concurrency is set" do
 | 
				
			||||||
            let :params do req_params.merge({:reaper_concurrency => 4682}) end
 | 
					            let :params do req_params.merge({:reaper_concurrency => 4682}) end
 | 
				
			||||||
            it { should contain_file(fragment_file) \
 | 
					            it { is_expected.to contain_file(fragment_file) \
 | 
				
			||||||
              .with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m)
 | 
					              .with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
@@ -119,7 +115,7 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
        if t == 'container'
 | 
					        if t == 'container'
 | 
				
			||||||
          describe "when allow_versioning is set" do
 | 
					          describe "when allow_versioning is set" do
 | 
				
			||||||
           let :params do req_params.merge({ :allow_versions => false, }) end
 | 
					           let :params do req_params.merge({ :allow_versions => false, }) end
 | 
				
			||||||
            it { should contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)}
 | 
					            it { is_expected.to contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)}
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
@@ -129,7 +125,7 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
          req_params
 | 
					          req_params
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it { should contain_rsync__server__module("#{t}").with(
 | 
					        it { is_expected.to contain_rsync__server__module("#{t}").with(
 | 
				
			||||||
          :path            => '/srv/node',
 | 
					          :path            => '/srv/node',
 | 
				
			||||||
          :lock_file       => "/var/lock/#{t}.lock",
 | 
					          :lock_file       => "/var/lock/#{t}.lock",
 | 
				
			||||||
          :uid             => 'swift',
 | 
					          :uid             => 'swift',
 | 
				
			||||||
@@ -141,42 +137,18 @@ describe 'swift::storage::server' do
 | 
				
			|||||||
        )}
 | 
					        )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # verify template lines
 | 
					        # verify template lines
 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^devices\s*=\s*\/srv\/node\s*$/) }
 | 
				
			||||||
          .with_content(/^devices\s*=\s*\/srv\/node\s*$/)
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/) }
 | 
				
			||||||
        }
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^bind_port\s*=\s*#{title}\s*$/) }
 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^mount_check\s*=\s*false\s*$/) }
 | 
				
			||||||
          .with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/)
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^user\s*=\s*swift\s*$/) }
 | 
				
			||||||
        }
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^set log_name\s*=\s*#{t}-server\s*$/) }
 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) }
 | 
				
			||||||
          .with_content(/^bind_port\s*=\s*#{title}\s*$/)
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^set log_level\s*=\s*INFO\s*$/) }
 | 
				
			||||||
        }
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) }
 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^workers\s*=\s*1\s*$/) }
 | 
				
			||||||
          .with_content(/^mount_check\s*=\s*false\s*$/)
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^concurrency\s*=\s*1\s*$/) }
 | 
				
			||||||
        }
 | 
					        it { is_expected.to contain_file(fragment_file).with_content(/^pipeline\s*=\s*#{t}-server\s*$/) }
 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^user\s*=\s*swift\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^set log_name\s*=\s*#{t}-server\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^set log_level\s*=\s*INFO\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^set log_address\s*=\s*\/dev\/log\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^workers\s*=\s*1\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^concurrency\s*=\s*1\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        it { should contain_file(fragment_file) \
 | 
					 | 
				
			||||||
          .with_content(/^pipeline\s*=\s*#{t}-server\s*$/)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,13 +32,13 @@ describe 'swift::storage::xfs' do
 | 
				
			|||||||
          param_set
 | 
					          param_set
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it { should contain_exec("mkfs-foo").with(
 | 
					        it { is_expected.to contain_exec("mkfs-foo").with(
 | 
				
			||||||
          :command     => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}",
 | 
					          :command     => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}",
 | 
				
			||||||
          :path        => ['/sbin/', '/usr/sbin/'],
 | 
					          :path        => ['/sbin/', '/usr/sbin/'],
 | 
				
			||||||
          :require     => 'Package[xfsprogs]'
 | 
					          :require     => 'Package[xfsprogs]'
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it { should contain_swift__storage__mount(title).with(
 | 
					        it { is_expected.to contain_swift__storage__mount(title).with(
 | 
				
			||||||
           :device       => param_hash[:device],
 | 
					           :device       => param_hash[:device],
 | 
				
			||||||
           :mnt_base_dir => param_hash[:mnt_base_dir],
 | 
					           :mnt_base_dir => param_hash[:mnt_base_dir],
 | 
				
			||||||
           :loopback     => param_hash[:loopback],
 | 
					           :loopback     => param_hash[:loopback],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
shared_examples_for "a Puppet::Error" do |description|
 | 
					shared_examples_for "a Puppet::Error" do |description|
 | 
				
			||||||
  it "with message matching #{description.inspect}" do
 | 
					  it "with message matching #{description.inspect}" do
 | 
				
			||||||
    expect { should have_class_count(1) }.to raise_error(Puppet::Error, description)
 | 
					    expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,26 +27,26 @@ Devices:    id  region  zone      ip address  port      replication ip  replicat
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    resources = provider_class.lookup_ring
 | 
					    resources = provider_class.lookup_ring
 | 
				
			||||||
    resources['192.168.101.13:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.13:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.14:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.14:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.15:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.15:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.16:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.16:6002/1']).to_not be_nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:id].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:region].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:region]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:zone].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:meta].should eql ''
 | 
					    expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:id].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:region].should eql '1'
 | 
					    expect(resources['192.168.101.14:6002/1'][:region]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:zone].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:balance].should eql '200.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:balance]).to eql '200.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:meta].should eql 'm2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:meta]).to eql 'm2'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it 'should be able to lookup the local ring and build an object 1.8.0' do
 | 
					  it 'should be able to lookup the local ring and build an object 1.8.0' do
 | 
				
			||||||
@@ -65,26 +65,26 @@ Devices:    id  region  zone      ip address  port      name weight partitions b
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    resources = provider_class.lookup_ring
 | 
					    resources = provider_class.lookup_ring
 | 
				
			||||||
    resources['192.168.101.13:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.13:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.14:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.14:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.15:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.15:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.16:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.16:6002/1']).to_not be_nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:id].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:region].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:region]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:zone].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:meta].should eql ''
 | 
					    expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:id].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:region].should eql '1'
 | 
					    expect(resources['192.168.101.14:6002/1'][:region]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:zone].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:balance].should eql '200.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:balance]).to eql '200.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:meta].should eql 'm2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:meta]).to eql 'm2'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it 'should be able to lookup the local ring and build an object 1.7' do
 | 
					  it 'should be able to lookup the local ring and build an object 1.7' do
 | 
				
			||||||
@@ -102,25 +102,25 @@ Devices:    id  region  zone      ip address  port      name weight partitions b
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    resources = provider_class.lookup_ring
 | 
					    resources = provider_class.lookup_ring
 | 
				
			||||||
    resources['192.168.101.13:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.13:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.14:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.14:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.15:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.15:6002/1']).to_not be_nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:id].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:region].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:region]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:zone].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:meta].should eql ''
 | 
					    expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:id].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:region].should eql '1'
 | 
					    expect(resources['192.168.101.14:6002/1'][:region]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:zone].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:balance].should eql '0.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:balance]).to eql '0.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:meta].should eql ''
 | 
					    expect(resources['192.168.101.14:6002/1'][:meta]).to eql ''
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it 'should be able to lookup the local ring and build an object legacy' do
 | 
					  it 'should be able to lookup the local ring and build an object legacy' do
 | 
				
			||||||
@@ -137,24 +137,24 @@ Devices:    id  zone      ip address  port      name weight partitions balance m
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    resources = provider_class.lookup_ring
 | 
					    resources = provider_class.lookup_ring
 | 
				
			||||||
    resources['192.168.101.15:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.15:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.13:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.13:6002/1']).to_not be_nil
 | 
				
			||||||
    resources['192.168.101.14:6002/1'].should_not be_nil
 | 
					    expect(resources['192.168.101.14:6002/1']).to_not be_nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:id].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:region].should eql 'none'
 | 
					    expect(resources['192.168.101.13:6002/1'][:region]).to eql 'none'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:zone].should eql '1'
 | 
					    expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
 | 
					    expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
 | 
				
			||||||
    resources['192.168.101.13:6002/1'][:meta].should eql ''
 | 
					    expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:id].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:region].should eql 'none'
 | 
					    expect(resources['192.168.101.14:6002/1'][:region]).to eql 'none'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:zone].should eql '2'
 | 
					    expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
 | 
					    expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:balance].should eql '0.00'
 | 
					    expect(resources['192.168.101.14:6002/1'][:balance]).to eql '0.00'
 | 
				
			||||||
    resources['192.168.101.14:6002/1'][:meta].should eql ''
 | 
					    expect(resources['192.168.101.14:6002/1'][:meta]).to eql ''
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user