Fix / remove deprecated tests according to previous commits
This commit is contained in:
parent
4501b267e9
commit
bb03504ff3
@ -7,7 +7,7 @@ Puppet::Type.newtype(:ring_account_device) do
|
||||
validate do |value|
|
||||
# Commit 103b68b changed the acceptable name from address:port/device to simply address:port.
|
||||
address = value.split(':')
|
||||
raise(Puppet::Error, "invalid name #{value}") unless address.size == 2
|
||||
raise(Puppet::Error, "invalid name #{value}: should contain address:port") unless address.size == 2
|
||||
IPAddr.new(address[0])
|
||||
end
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ Puppet::Type.newtype(:ring_container_device) do
|
||||
validate do |value|
|
||||
# Commit 103b68b changed the acceptable format from address:port/device to just address:port.
|
||||
address = value.split(':')
|
||||
raise(Puppet::Error, "invalid name #{value}") unless address.size == 2
|
||||
raise(Puppet::Error, "invalid name #{value}: should contain address:port") unless address.size == 2
|
||||
IPAddr.new(address[0])
|
||||
end
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ Puppet::Type.newtype(:ring_object_device) do
|
||||
validate do |value|
|
||||
# Commit 103b68b changed acceptable format from address:port/device to just address:port.
|
||||
address = value.split(':')
|
||||
raise(Puppet::Error, "invalid name #{value}e") unless address.size == 2
|
||||
raise(Puppet::Error, "invalid name #{value}: should contain address:port") unless address.size == 2
|
||||
IPAddr.new(address[0])
|
||||
end
|
||||
end
|
||||
|
@ -1,11 +1,29 @@
|
||||
class swift::keystone::auth(
|
||||
$auth_name = 'swift',
|
||||
$password = 'swift_password',
|
||||
$internal_address = '127.0.0.1',
|
||||
$admin_address = '127.0.0.1',
|
||||
$public_address = '127.0.0.1',
|
||||
$address = '127.0.0.1',
|
||||
$internal_address = undef,
|
||||
$admin_address = undef,
|
||||
$public_address = undef,
|
||||
$port = '8080'
|
||||
) {
|
||||
if ($internal_address == undef) {
|
||||
$internal_address_real = $address
|
||||
} else {
|
||||
$internal_address_real = $internal_address
|
||||
}
|
||||
|
||||
if ($admin_address == undef) {
|
||||
$admin_address_real = $address
|
||||
} else {
|
||||
$admin_address_real = $admin_address
|
||||
}
|
||||
|
||||
if ($public_address == undef) {
|
||||
$public_address_real = $address
|
||||
} else {
|
||||
$public_address_real = $public_address
|
||||
}
|
||||
|
||||
keystone_user { $auth_name:
|
||||
ensure => present,
|
||||
@ -25,9 +43,9 @@ class swift::keystone::auth(
|
||||
keystone_endpoint { $auth_name:
|
||||
ensure => present,
|
||||
region => 'RegionOne',
|
||||
public_url => "http://${public_address}:${port}/v1/AUTH_%(tenant_id)s",
|
||||
admin_url => "http://${admin_address}:${port}/",
|
||||
internal_url => "http://${internal_address}:${port}/v1/AUTH_%(tenant_id)s",
|
||||
public_url => "http://${public_address_real}:${port}/v1/AUTH_%(tenant_id)s",
|
||||
admin_url => "http://${admin_address_real}:${port}/",
|
||||
internal_url => "http://${internal_address_real}:${port}/v1/AUTH_%(tenant_id)s",
|
||||
}
|
||||
|
||||
keystone_service { "${auth_name}_s3":
|
||||
@ -38,9 +56,9 @@ class swift::keystone::auth(
|
||||
keystone_endpoint { "${auth_name}_s3":
|
||||
ensure => present,
|
||||
region => 'RegionOne',
|
||||
public_url => "http://${public_address}:${port}",
|
||||
admin_url => "http://${admin_address}:${port}",
|
||||
internal_url => "http://${internal_address}:${port}",
|
||||
public_url => "http://${public_address_real}:${port}",
|
||||
admin_url => "http://${admin_address_real}:${port}",
|
||||
internal_url => "http://${internal_address_real}:${port}",
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
define swift::storage::node(
|
||||
$mnt_base_dir,
|
||||
$zone,
|
||||
$weight = 1,
|
||||
$owner = 'swift',
|
||||
$group = 'swift',
|
||||
$max_connections = 25,
|
||||
@ -16,6 +15,7 @@ define swift::storage::node(
|
||||
) {
|
||||
|
||||
Swift::Storage::Server {
|
||||
swift_zone => $zone,
|
||||
storage_local_net_ip => $storage_local_net_ip,
|
||||
devices => $mnt_base_dir,
|
||||
max_connections => $max_connections,
|
||||
@ -26,25 +26,22 @@ define swift::storage::node(
|
||||
swift::storage::server { "60${name}0":
|
||||
type => 'object',
|
||||
}
|
||||
ring_object_device { "${storage_local_net_ip}:60${name}0/$name":
|
||||
ring_object_device { "${storage_local_net_ip}:60${name}0":
|
||||
zone => $zone,
|
||||
weight => $weight,
|
||||
}
|
||||
|
||||
swift::storage::server { "60${name}1":
|
||||
type => 'container',
|
||||
}
|
||||
ring_container_device { "${storage_local_net_ip}:60${name}1/$name":
|
||||
ring_container_device { "${storage_local_net_ip}:60${name}1":
|
||||
zone => $zone,
|
||||
weight => $weight,
|
||||
}
|
||||
|
||||
swift::storage::server { "60${name}2":
|
||||
type => 'account',
|
||||
}
|
||||
ring_account_device { "${storage_local_net_ip}:60${name}2/$name":
|
||||
ring_account_device { "${storage_local_net_ip}:60${name}2":
|
||||
zone => $zone,
|
||||
weight => $weight,
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,12 +22,13 @@ define swift::storage::server(
|
||||
# this parameters needs to be specified after type and name
|
||||
$config_file_path = "${type}-server/${name}.conf"
|
||||
) {
|
||||
|
||||
if (is_array($pipeline)) {
|
||||
$pipeline_real = $pipeline
|
||||
} else {
|
||||
$pipeline_real = [$pipeline]
|
||||
}
|
||||
# TODO if array does not include type-server, warn
|
||||
if(
|
||||
(is_array($pipeline) and ! member($pipeline, "${type}-server")) or
|
||||
$pipeline != "${type}-server"
|
||||
) {
|
||||
if(! member($pipeline_real, "${type}-server")) {
|
||||
warning("swift storage server ${type} must specify ${type}-server")
|
||||
}
|
||||
|
||||
@ -36,7 +37,6 @@ define swift::storage::server(
|
||||
|
||||
validate_re($name, '^\d+$')
|
||||
validate_re($type, '^object|container|account$')
|
||||
validate_array($pipeline)
|
||||
# TODO - validate that name is an integer
|
||||
|
||||
$bind_port = $name
|
||||
@ -60,7 +60,7 @@ define swift::storage::server(
|
||||
$required_middlewares = split(
|
||||
inline_template(
|
||||
"<%=
|
||||
(pipeline - ['${type}-server']).collect do |x|
|
||||
(pipeline_real - ['${type}-server']).collect do |x|
|
||||
'Swift::Storage::Filter::' + x + '[${type}]'
|
||||
end.join(',')
|
||||
%>"), ',')
|
||||
|
@ -33,7 +33,7 @@ describe 'swift::proxy::cache' do
|
||||
describe 'with overridden memcache server' do
|
||||
|
||||
let :params do
|
||||
{:memcache_servers => '10.0.0.1:1'}
|
||||
{:memcache_servers => ['10.0.0.1:1']}
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) }
|
||||
|
@ -61,39 +61,36 @@ describe 'swift::ringbuilder' do
|
||||
'class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_suffix => string }
|
||||
class { "ssh::server::install": }
|
||||
ring_object_device { "127.0.0.1:6000/1":
|
||||
ring_object_device { "127.0.0.1:6000":
|
||||
zone => 1,
|
||||
weight => 1,
|
||||
}
|
||||
|
||||
ring_container_device { "127.0.0.1:6001/1":
|
||||
ring_container_device { "127.0.0.1:6001":
|
||||
zone => 2,
|
||||
weight => 1,
|
||||
}
|
||||
|
||||
ring_account_device { "127.0.0.1:6002/1":
|
||||
ring_account_device { "127.0.0.1:6002":
|
||||
zone => 3,
|
||||
weight => 1,
|
||||
}'
|
||||
end
|
||||
|
||||
it 'should set up all of the correct dependencies' do
|
||||
should 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]'}
|
||||
)
|
||||
should 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]'}
|
||||
)
|
||||
should 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]'}
|
||||
)
|
||||
should contain_ring_object_device('127.0.0.1:6000/1').with(
|
||||
should contain_ring_object_device('127.0.0.1:6000').with(
|
||||
{:notify => 'Swift::Ringbuilder::Rebalance[object]'}
|
||||
)
|
||||
should contain_ring_container_device('127.0.0.1:6001/1').with(
|
||||
should contain_ring_container_device('127.0.0.1:6001').with(
|
||||
{:notify => 'Swift::Ringbuilder::Rebalance[container]'}
|
||||
)
|
||||
should contain_ring_account_device('127.0.0.1:6002/1').with(
|
||||
should contain_ring_account_device('127.0.0.1:6002').with(
|
||||
{:notify => 'Swift::Ringbuilder::Rebalance[account]'}
|
||||
)
|
||||
end
|
||||
|
@ -27,14 +27,9 @@ describe 'swift::storage::all' do
|
||||
}
|
||||
end
|
||||
|
||||
describe 'when an internal network ip is not specified' do
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/)
|
||||
end
|
||||
end
|
||||
|
||||
[{ :storage_local_net_ip => '127.0.0.1' },
|
||||
[{ :swift_zone => '1', :storage_local_net_ip => '127.0.0.1' },
|
||||
{
|
||||
:swift_zone => '1',
|
||||
:devices => '/tmp/node',
|
||||
:storage_local_net_ip => '10.0.0.1',
|
||||
:object_port => '7000',
|
||||
@ -98,14 +93,6 @@ describe 'swift::storage::all' do
|
||||
:config_file_path => 'container-server.conf',
|
||||
:pipeline => param_hash[:container_pipeline] || 'container-server' }.merge(storage_server_defaults)
|
||||
)}
|
||||
|
||||
it { should contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => param_hash[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
}
|
||||
)}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -118,8 +105,9 @@ describe 'swift::storage::all' do
|
||||
}
|
||||
end
|
||||
|
||||
[{ :storage_local_net_ip => '127.0.0.1' },
|
||||
[{ :swift_zone => '1', :storage_local_net_ip => '127.0.0.1' },
|
||||
{
|
||||
:swift_zone => '1',
|
||||
:devices => '/tmp/node',
|
||||
:storage_local_net_ip => '10.0.0.1',
|
||||
:object_port => '7000',
|
||||
|
@ -23,13 +23,6 @@ describe 'swift::storage' do
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => params[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
}
|
||||
)}
|
||||
end
|
||||
describe 'when local net ip is not specified' do
|
||||
it 'should fail' do
|
||||
|
@ -27,8 +27,8 @@ describe 'swift::storage::node' do
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_ring_object_device("127.0.0.1:6010/1")
|
||||
should contain_ring_container_device("127.0.0.1:6011/1")
|
||||
should contain_ring_account_device("127.0.0.1:6012/1")
|
||||
should contain_ring_object_device("127.0.0.1:6010")
|
||||
should contain_ring_container_device("127.0.0.1:6011")
|
||||
should contain_ring_account_device("127.0.0.1:6012")
|
||||
}
|
||||
end
|
||||
|
@ -25,8 +25,9 @@ describe 'swift::storage::server' do
|
||||
|
||||
describe 'with an invalid title' do
|
||||
let :params do
|
||||
{:storage_local_net_ip => '127.0.0.1',
|
||||
:type => 'object'}
|
||||
{:swift_zone => '1',
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
:type => 'object'}
|
||||
end
|
||||
let :title do
|
||||
'foo'
|
||||
@ -45,7 +46,7 @@ describe 'swift::storage::server' do
|
||||
end
|
||||
|
||||
let :req_params do
|
||||
{:storage_local_net_ip => '10.0.0.1', :type => t}
|
||||
{:swift_zone => '1', :storage_local_net_ip => '10.0.0.1', :type => t}
|
||||
end
|
||||
let :params do
|
||||
req_params
|
||||
@ -67,7 +68,7 @@ describe 'swift::storage::server' do
|
||||
:user => 'dan',
|
||||
:mount_check => true,
|
||||
:workers => 7,
|
||||
:pipeline => ['foo']
|
||||
:pipeline => 'foo'
|
||||
}.each do |k,v|
|
||||
describe "when #{k} is set" do
|
||||
let :params do req_params.merge({k => v}) end
|
||||
@ -83,12 +84,6 @@ describe 'swift::storage::server' do
|
||||
:before => ["Swift::Storage::Filter::1[#{t}]", "Swift::Storage::Filter::2[#{t}]", "Swift::Storage::Filter::3[#{t}]"]
|
||||
})}
|
||||
end
|
||||
describe "when pipeline is not passed an array" do
|
||||
let :params do req_params.merge({:pipeline => 'not an array'}) end
|
||||
it "should fail" do
|
||||
expect { subject }.to raise_error(Puppet::Error, /is not an Array/)
|
||||
end
|
||||
end
|
||||
describe "when replicator_concurrency is set" do
|
||||
let :params do req_params.merge({:replicator_concurrency => 42}) end
|
||||
it { should contain_file(fragment_file) \
|
||||
|
@ -26,8 +26,8 @@ Devices: id zone ip address port name weight partitions balance m
|
||||
'
|
||||
)
|
||||
resources = provider_class.lookup_ring.inspect
|
||||
resources['192.168.101.15:6002/1'].should_not be_nil
|
||||
resources['192.168.101.13:6002/1'].should_not be_nil
|
||||
resources['192.168.101.14:6002/1'].should_not be_nil
|
||||
resources['192.168.101.15:6002'].should_not be_nil
|
||||
resources['192.168.101.13:6002'].should_not be_nil
|
||||
resources['192.168.101.14:6002'].should_not be_nil
|
||||
end
|
||||
end
|
||||
|
@ -4,12 +4,6 @@ describe Puppet::Type.type(:ring_account_device) do
|
||||
it 'should fail if the name has no ":"' do
|
||||
expect {
|
||||
Puppet::Type.type(:ring_account_device).new(:name => 'foo/bar')
|
||||
}.to raise_error(Puppet::Error, /should contain address:port\/device/)
|
||||
end
|
||||
|
||||
it 'should fail if the name does not contain a "/"' do
|
||||
expect {
|
||||
Puppet::Type.type(:ring_account_device).new(:name => 'foo:80')
|
||||
}.to raise_error(Puppet::Error, /should contain a device/)
|
||||
}.to raise_error(Puppet::Error, /should contain address:port/)
|
||||
end
|
||||
end
|
||||
|
@ -5,12 +5,6 @@ describe Puppet::Type.type(:ring_container_device) do
|
||||
it 'should fail if the name has no ":"' do
|
||||
expect {
|
||||
Puppet::Type.type(:ring_account_device).new(:name => 'foo/bar')
|
||||
}.to raise_error(Puppet::Error, /should contain address:port\/device/)
|
||||
end
|
||||
|
||||
it 'should fail if the name does not contain a "/"' do
|
||||
expect {
|
||||
Puppet::Type.type(:ring_account_device).new(:name => 'foo:80')
|
||||
}.to raise_error(Puppet::Error, /should contain a device/)
|
||||
}.to raise_error(Puppet::Error, /should contain address:port/)
|
||||
end
|
||||
end
|
||||
|
@ -4,12 +4,6 @@ describe Puppet::Type.type(:ring_object_device) do
|
||||
it 'should fail if the name has no ":"' do
|
||||
expect {
|
||||
Puppet::Type.type(:ring_account_device).new(:name => 'foo/bar')
|
||||
}.to raise_error(Puppet::Error, /should contain address:port\/device/)
|
||||
end
|
||||
|
||||
it 'should fail if the name does not contain a "/"' do
|
||||
expect {
|
||||
Puppet::Type.type(:ring_account_device).new(:name => 'foo:80')
|
||||
}.to raise_error(Puppet::Error, /should contain a device/)
|
||||
}.to raise_error(Puppet::Error, /should contain address:port/)
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ log_facility = LOG_LOCAL2
|
||||
workers = <%= workers %>
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = <%= pipeline.to_a.join(' ') %>
|
||||
pipeline = <%= pipeline_real.join(' ') %>
|
||||
|
||||
[app:account-server]
|
||||
use = egg:swift#account
|
||||
|
@ -8,7 +8,7 @@ log_facility = LOG_LOCAL2
|
||||
workers = <%= workers %>
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = <%= pipeline.to_a.join(' ') %>
|
||||
pipeline = <%= pipeline_real.join(' ') %>
|
||||
|
||||
[app:container-server]
|
||||
use = egg:swift#container
|
||||
|
@ -8,7 +8,7 @@ log_facility = LOG_LOCAL2
|
||||
workers = <%= workers %>
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = <%= pipeline.to_a.join(' ') %>
|
||||
pipeline = <%= pipeline_real.join(' ') %>
|
||||
|
||||
[app:object-server]
|
||||
use = egg:swift#object
|
||||
|
Loading…
Reference in New Issue
Block a user