Update specs to be rubocop compliant
- Update rubocop config to include specs/** - Update specs to comply with rubocop Change-Id: I50734daada5c8fb3a40e8e9e02b0732843dc1d9b Implements: blueprint rubocop-for-object-storage
This commit is contained in:
@@ -6,9 +6,9 @@ AllCops:
|
||||
- providers/**
|
||||
- recipes/**
|
||||
- resources/**
|
||||
- spec/**
|
||||
Excludes:
|
||||
- libraries/**
|
||||
- spec/**
|
||||
|
||||
Encoding:
|
||||
Exclude:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::account-server' do
|
||||
@@ -6,7 +7,7 @@ describe 'openstack-object-storage::account-server' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@@ -17,48 +18,48 @@ describe 'openstack-object-storage::account-server' do
|
||||
@node.set['swift']['network']['account-bind-ip'] = '10.0.0.1'
|
||||
@node.set['swift']['network']['account-bind-port'] = '8080'
|
||||
@node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]"
|
||||
@node.set['swift']['disk_test_filter'] = [ "candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/",
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
@node.set['swift']['disk_test_filter'] = ['candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/',
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
|
||||
# mock out an interface on the storage node
|
||||
@node.set["network"] = MOCK_NODE_NETWORK_DATA['network']
|
||||
@node.set['network'] = MOCK_NODE_NETWORK_DATA['network']
|
||||
|
||||
@chef_run.converge "openstack-object-storage::account-server"
|
||||
@chef_run.converge 'openstack-object-storage::account-server'
|
||||
end
|
||||
|
||||
it "installs swift account packages" do
|
||||
expect(@chef_run).to install_package "swift-account"
|
||||
it 'installs swift account packages' do
|
||||
expect(@chef_run).to install_package 'swift-account'
|
||||
end
|
||||
|
||||
it "installs swiftclient package" do
|
||||
expect(@chef_run).to install_package "python-swiftclient"
|
||||
it 'installs swiftclient package' do
|
||||
expect(@chef_run).to install_package 'python-swiftclient'
|
||||
end
|
||||
|
||||
it "starts swift account services on boot" do
|
||||
it 'starts swift account services on boot' do
|
||||
%w{swift-account swift-account-auditor swift-account-reaper swift-account-replicator}.each do |svc|
|
||||
expect(@chef_run).to enable_service(svc)
|
||||
end
|
||||
end
|
||||
|
||||
describe "/etc/swift/account-server.conf" do
|
||||
describe '/etc/swift/account-server.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/account-server.conf"
|
||||
@file = @chef_run.template '/etc/swift/account-server.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "600"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '600'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::common' do
|
||||
@@ -6,90 +7,88 @@ describe 'openstack-object-storage::common' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
|
||||
@node = @chef_run.node
|
||||
@node.set['platform_family'] = "debian"
|
||||
@node.set['lsb']['codename'] = "precise"
|
||||
@node.set['swift']['release'] = "havana"
|
||||
@node.set['platform_family'] = 'debian'
|
||||
@node.set['lsb']['codename'] = 'precise'
|
||||
@node.set['swift']['release'] = 'havana'
|
||||
@node.set['swift']['authmode'] = 'swauth'
|
||||
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
|
||||
|
||||
# TODO: this does not work
|
||||
# ::Chef::Log.should_receive(:info).with("chefspec: precise-updates/havana")
|
||||
# ::Chef::Log.should_receive(:info).with('chefspec: precise-updates/havana')
|
||||
|
||||
@chef_run.converge "openstack-object-storage::common"
|
||||
@chef_run.converge 'openstack-object-storage::common'
|
||||
end
|
||||
|
||||
|
||||
it 'should set syctl paramaters' do
|
||||
# N.B. we could examine chef log
|
||||
pending "TODO: right now theres no way to do lwrp and test for this"
|
||||
pending 'TODO: right now theres no way to do lwrp and test for this'
|
||||
end
|
||||
|
||||
it 'installs git package for ring management' do
|
||||
expect(@chef_run).to install_package "git"
|
||||
expect(@chef_run).to install_package 'git'
|
||||
end
|
||||
|
||||
describe "/etc/swift" do
|
||||
describe '/etc/swift' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.directory "/etc/swift"
|
||||
@file = @chef_run.directory '/etc/swift'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "700"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '700'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "/etc/swift/swift.conf" do
|
||||
describe '/etc/swift/swift.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.file "/etc/swift/swift.conf"
|
||||
@file = @chef_run.file '/etc/swift/swift.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "700"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '700'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "/etc/swift/pull-rings.sh" do
|
||||
describe '/etc/swift/pull-rings.sh' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/pull-rings.sh"
|
||||
@file = @chef_run.template '/etc/swift/pull-rings.sh'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "700"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '700'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::container-server' do
|
||||
@@ -6,7 +7,7 @@ describe 'openstack-object-storage::container-server' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@@ -19,66 +20,66 @@ describe 'openstack-object-storage::container-server' do
|
||||
@node.set['swift']['container-server']['allowed_sync_hosts'] = ['host1', 'host2', 'host3']
|
||||
@node.set['swift']['container-bind-port'] = '8080'
|
||||
@node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]"
|
||||
@node.set['swift']['disk_test_filter'] = [ "candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/",
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
@node.set['swift']['disk_test_filter'] = ['candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/',
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
|
||||
# mock out an interface on the storage node
|
||||
@node.set["network"] = MOCK_NODE_NETWORK_DATA['network']
|
||||
@node.set['network'] = MOCK_NODE_NETWORK_DATA['network']
|
||||
|
||||
@chef_run.converge "openstack-object-storage::container-server"
|
||||
@chef_run.converge 'openstack-object-storage::container-server'
|
||||
end
|
||||
|
||||
it "installs swift container packages" do
|
||||
expect(@chef_run).to install_package "swift-container"
|
||||
it 'installs swift container packages' do
|
||||
expect(@chef_run).to install_package 'swift-container'
|
||||
end
|
||||
|
||||
it "starts swift container services on boot" do
|
||||
it 'starts swift container services on boot' do
|
||||
%w{swift-container swift-container-auditor swift-container-replicator swift-container-updater swift-container-sync}.each do |svc|
|
||||
expect(@chef_run).to enable_service(svc)
|
||||
end
|
||||
end
|
||||
|
||||
describe "/etc/swift/container-server.conf" do
|
||||
describe '/etc/swift/container-server.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/container-server.conf"
|
||||
@file = @chef_run.template '/etc/swift/container-server.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "600"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '600'
|
||||
end
|
||||
|
||||
it "has allowed sync hosts" do
|
||||
expect(@chef_run).to render_file(@file.name).with_content("allowed_sync_hosts = host1,host2,host3")
|
||||
it 'has allowed sync hosts' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('allowed_sync_hosts = host1,host2,host3')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "should create container sync upstart conf for ubuntu" do
|
||||
expect(@chef_run).to create_cookbook_file "/etc/init/swift-container-sync.conf"
|
||||
it 'should create container sync upstart conf for ubuntu' do
|
||||
expect(@chef_run).to create_cookbook_file '/etc/init/swift-container-sync.conf'
|
||||
end
|
||||
|
||||
it "should create container sync init script for ubuntu" do
|
||||
expect(@chef_run).to create_link "/etc/init.d/swift-container-sync"
|
||||
it 'should create container sync init script for ubuntu' do
|
||||
expect(@chef_run).to create_link '/etc/init.d/swift-container-sync'
|
||||
end
|
||||
|
||||
describe "/etc/swift/container-server.conf" do
|
||||
describe '/etc/swift/container-server.conf' do
|
||||
|
||||
before do
|
||||
@node = @chef_run.node
|
||||
@node.set["swift"]["container-server"]["allowed_sync_hosts"] = []
|
||||
@chef_run.converge "openstack-object-storage::container-server"
|
||||
@file = @chef_run.template "/etc/swift/container-server.conf"
|
||||
@node.set['swift']['container-server']['allowed_sync_hosts'] = []
|
||||
@chef_run.converge 'openstack-object-storage::container-server'
|
||||
@file = @chef_run.template '/etc/swift/container-server.conf'
|
||||
end
|
||||
|
||||
it "has no allowed_sync_hosts on empty lists" do
|
||||
it 'has no allowed_sync_hosts on empty lists' do
|
||||
expect(@chef_run).not_to render_file(@file.name).with_content(/^allowed_sync_hots =/)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::disks' do
|
||||
@@ -6,35 +7,35 @@ describe 'openstack-object-storage::disks' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
|
||||
@node = @chef_run.node
|
||||
@node.set['platform_family'] = "debian"
|
||||
@node.set['lsb']['codename'] = "precise"
|
||||
@node.set['swift']['release'] = "havana"
|
||||
@node.set['platform_family'] = 'debian'
|
||||
@node.set['lsb']['codename'] = 'precise'
|
||||
@node.set['swift']['release'] = 'havana'
|
||||
@node.set['swift']['authmode'] = 'swauth'
|
||||
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
|
||||
@node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]"
|
||||
@node.set['swift']['disk_test_filter'] = [ "candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/",
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
@node.set['swift']['disk_test_filter'] = ['candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/',
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
|
||||
# mock out an interface on the storage node
|
||||
@node.set["network"] = MOCK_NODE_NETWORK_DATA['network']
|
||||
@node.set['network'] = MOCK_NODE_NETWORK_DATA['network']
|
||||
|
||||
@chef_run.converge "openstack-object-storage::disks"
|
||||
@chef_run.converge 'openstack-object-storage::disks'
|
||||
end
|
||||
|
||||
it 'installs xfs progs package' do
|
||||
expect(@chef_run).to install_package "xfsprogs"
|
||||
expect(@chef_run).to install_package 'xfsprogs'
|
||||
end
|
||||
|
||||
it 'installs parted package' do
|
||||
expect(@chef_run).to install_package "parted"
|
||||
expect(@chef_run).to install_package 'parted'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::management-server' do
|
||||
@@ -6,7 +7,7 @@ describe 'openstack-object-storage::management-server' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@@ -18,50 +19,50 @@ describe 'openstack-object-storage::management-server' do
|
||||
@node.set['swift']['swauth_source'] = 'package'
|
||||
@node.set['swift']['platform']['swauth_packages'] = ['swauth']
|
||||
|
||||
@chef_run.converge "openstack-object-storage::management-server"
|
||||
@chef_run.converge 'openstack-object-storage::management-server'
|
||||
end
|
||||
|
||||
it "installs swift swauth package" do
|
||||
expect(@chef_run).to install_package "swauth"
|
||||
it 'installs swift swauth package' do
|
||||
expect(@chef_run).to install_package 'swauth'
|
||||
end
|
||||
|
||||
describe "/etc/swift/dispersion.conf" do
|
||||
describe '/etc/swift/dispersion.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/dispersion.conf"
|
||||
@file = @chef_run.template '/etc/swift/dispersion.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "600"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '600'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "/usr/local/bin/swift-statsd-publish.py" do
|
||||
describe '/usr/local/bin/swift-statsd-publish.py' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/usr/local/bin/swift-statsd-publish.py"
|
||||
@file = @chef_run.template '/usr/local/bin/swift-statsd-publish.py'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("root")
|
||||
expect(@file.group).to eq("root")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('root')
|
||||
expect(@file.group).to eq('root')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "755"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '755'
|
||||
end
|
||||
|
||||
it "has expected statsd host" do
|
||||
it 'has expected statsd host' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content("self.statsd_host = '127.0.0.1'")
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::object-server' do
|
||||
@@ -6,7 +7,7 @@ describe 'openstack-object-storage::object-server' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@@ -17,52 +18,52 @@ describe 'openstack-object-storage::object-server' do
|
||||
@node.set['swift']['network']['object-bind-ip'] = '10.0.0.1'
|
||||
@node.set['swift']['network']['object-bind-port'] = '8080'
|
||||
@node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]"
|
||||
@node.set['swift']['disk_test_filter'] = [ "candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/",
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
@node.set['swift']['disk_test_filter'] = ['candidate =~ /sd[^a]/ or candidate =~ /hd[^a]/ or candidate =~ /vd[^a]/ or candidate =~ /xvd[^a]/',
|
||||
"File.exist?('/dev/' + candidate)",
|
||||
"not system('/sbin/parted /dev/' + candidate + ' -s print | grep linux-swap')",
|
||||
"not info.has_key?('removable') or info['removable'] == 0.to_s"]
|
||||
|
||||
# mock out an interface on the storage node
|
||||
@node.set["network"] = MOCK_NODE_NETWORK_DATA['network']
|
||||
@node.set['network'] = MOCK_NODE_NETWORK_DATA['network']
|
||||
|
||||
@chef_run.converge "openstack-object-storage::object-server"
|
||||
@chef_run.converge 'openstack-object-storage::object-server'
|
||||
end
|
||||
|
||||
it "installs swift packages" do
|
||||
expect(@chef_run).to install_package "swift-object"
|
||||
it 'installs swift packages' do
|
||||
expect(@chef_run).to install_package 'swift-object'
|
||||
end
|
||||
|
||||
it "starts swift object services on boot" do
|
||||
it 'starts swift object services on boot' do
|
||||
%w{swift-object swift-object-replicator swift-object-auditor swift-object-updater}.each do |svc|
|
||||
expect(@chef_run).to enable_service(svc)
|
||||
end
|
||||
end
|
||||
|
||||
describe "/var/spool/crontab/root" do
|
||||
describe '/var/spool/crontab/root' do
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: check for recon script"
|
||||
it 'template contents' do
|
||||
pending 'TODO: check for recon script'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "/etc/swift/object-server.conf" do
|
||||
describe '/etc/swift/object-server.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/object-server.conf"
|
||||
@file = @chef_run.template '/etc/swift/object-server.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "600"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '600'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::proxy-server' do
|
||||
@@ -6,7 +7,7 @@ describe 'openstack-object-storage::proxy-server' do
|
||||
# UBUNTU
|
||||
#--------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@@ -18,42 +19,42 @@ describe 'openstack-object-storage::proxy-server' do
|
||||
@node.set['swift']['swauth_source'] = 'package'
|
||||
@node.set['swift']['network']['proxy-bind-ip'] = '10.0.0.1'
|
||||
@node.set['swift']['network']['proxy-bind-port'] = '8080'
|
||||
@chef_run.converge "openstack-object-storage::proxy-server"
|
||||
@chef_run.converge 'openstack-object-storage::proxy-server'
|
||||
end
|
||||
|
||||
it "installs memcache python packages" do
|
||||
expect(@chef_run).to install_package "python-memcache"
|
||||
it 'installs memcache python packages' do
|
||||
expect(@chef_run).to install_package 'python-memcache'
|
||||
end
|
||||
|
||||
it "installs swift packages" do
|
||||
expect(@chef_run).to install_package "swift-proxy"
|
||||
it 'installs swift packages' do
|
||||
expect(@chef_run).to install_package 'swift-proxy'
|
||||
end
|
||||
|
||||
it "installs swauth package if swauth is selected" do
|
||||
expect(@chef_run).to install_package "swauth"
|
||||
it 'installs swauth package if swauth is selected' do
|
||||
expect(@chef_run).to install_package 'swauth'
|
||||
end
|
||||
|
||||
it "starts swift-proxy on boot" do
|
||||
expect(@chef_run).to enable_service("swift-proxy")
|
||||
it 'starts swift-proxy on boot' do
|
||||
expect(@chef_run).to enable_service('swift-proxy')
|
||||
end
|
||||
|
||||
describe "/etc/swift/proxy-server.conf" do
|
||||
describe '/etc/swift/proxy-server.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/proxy-server.conf"
|
||||
@file = @chef_run.template '/etc/swift/proxy-server.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "600"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '600'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::ring-repo' do
|
||||
@@ -6,34 +7,34 @@ describe 'openstack-object-storage::ring-repo' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
|
||||
@node = @chef_run.node
|
||||
@node.set['platform_family'] = "debian"
|
||||
@node.set['lsb']['codename'] = "precise"
|
||||
@node.set['swift']['release'] = "havana"
|
||||
@node.set['platform_family'] = 'debian'
|
||||
@node.set['lsb']['codename'] = 'precise'
|
||||
@node.set['swift']['release'] = 'havana'
|
||||
@node.set['swift']['authmode'] = 'swauth'
|
||||
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
|
||||
@chef_run.converge "openstack-object-storage::ring-repo"
|
||||
@chef_run.converge 'openstack-object-storage::ring-repo'
|
||||
end
|
||||
|
||||
it 'installs git package for ring management' do
|
||||
expect(@chef_run).to install_package "git-daemon-sysvinit"
|
||||
expect(@chef_run).to install_package 'git-daemon-sysvinit'
|
||||
end
|
||||
|
||||
it "should not start xinetd services on boot" do
|
||||
it 'should not start xinetd services on boot' do
|
||||
%w{xinetd}.each do |svc|
|
||||
expect(@chef_run).not_to enable_service(svc)
|
||||
end
|
||||
end
|
||||
|
||||
describe "/etc/swift/ring-workspace/generate-rings.sh" do
|
||||
describe '/etc/swift/ring-workspace/generate-rings.sh' do
|
||||
|
||||
it "gets installed" do
|
||||
pending "TODO: determine some way to ensure this LWRP script gets created"
|
||||
it 'gets installed' do
|
||||
pending 'TODO: determine some way to ensure this LWRP script gets created'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::rsync' do
|
||||
@@ -6,42 +7,42 @@ describe 'openstack-object-storage::rsync' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
|
||||
@node = @chef_run.node
|
||||
@node.set['platform_family'] = "debian"
|
||||
@node.set['lsb']['codename'] = "precise"
|
||||
@node.set['swift']['release'] = "havana"
|
||||
@node.set['platform_family'] = 'debian'
|
||||
@node.set['lsb']['codename'] = 'precise'
|
||||
@node.set['swift']['release'] = 'havana'
|
||||
@node.set['swift']['authmode'] = 'swauth'
|
||||
@node.set['swift']['git_builder_ip'] = '10.0.0.10'
|
||||
@chef_run.converge "openstack-object-storage::rsync"
|
||||
@chef_run.converge 'openstack-object-storage::rsync'
|
||||
end
|
||||
|
||||
it 'installs git package for ring management' do
|
||||
expect(@chef_run).to install_package "rsync"
|
||||
expect(@chef_run).to install_package 'rsync'
|
||||
end
|
||||
|
||||
it "starts rsync service on boot" do
|
||||
it 'starts rsync service on boot' do
|
||||
%w{rsync}.each do |svc|
|
||||
expect(@chef_run).to enable_service(svc)
|
||||
end
|
||||
end
|
||||
|
||||
describe "/etc/rsyncd.conf" do
|
||||
describe '/etc/rsyncd.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/rsyncd.conf"
|
||||
@file = @chef_run.template '/etc/rsyncd.conf'
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '644'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,62 +1,63 @@
|
||||
require "chefspec"
|
||||
require "chefspec/berkshelf"
|
||||
# encoding: UTF-8
|
||||
require 'chefspec'
|
||||
require 'chefspec/berkshelf'
|
||||
|
||||
::LOG_LEVEL = :fatal
|
||||
::REDHAT_OPTS = {
|
||||
:platform => "redhat",
|
||||
:log_level => ::LOG_LEVEL
|
||||
platform: 'redhat',
|
||||
log_level: ::LOG_LEVEL
|
||||
}
|
||||
::UBUNTU_OPTS = {
|
||||
:platform => "ubuntu",
|
||||
:version => "12.04",
|
||||
:log_level => ::LOG_LEVEL
|
||||
platform: 'ubuntu',
|
||||
version: '12.04',
|
||||
log_level: ::LOG_LEVEL
|
||||
}
|
||||
|
||||
MOCK_NODE_NETWORK_DATA =
|
||||
{
|
||||
"ipaddress" => '10.0.0.2',
|
||||
"fqdn" => 'localhost.localdomain',
|
||||
"hostname" => 'localhost',
|
||||
"network" => {
|
||||
"default_interface" => "eth0",
|
||||
"interfaces" => {
|
||||
"eth0" => {
|
||||
"addresses" => {
|
||||
"fe80::a00:27ff:feca:ab08" => {"scope" => "Link", "prefixlen" => "64", "family" => "inet6"},
|
||||
"10.0.0.2" => {"netmask" => "255.255.255.0", "broadcast" => "10.0.0.255", "family" => "inet"},
|
||||
"08:00:27:CA:AB:08" => {"family" => "lladdr"}
|
||||
},
|
||||
'ipaddress' => '10.0.0.2',
|
||||
'fqdn' => 'localhost.localdomain',
|
||||
'hostname' => 'localhost',
|
||||
'network' => {
|
||||
'default_interface' => 'eth0',
|
||||
'interfaces' => {
|
||||
'eth0' => {
|
||||
'addresses' => {
|
||||
'fe80::a00:27ff:feca:ab08' => { 'scope' => 'Link', 'prefixlen' => '64', 'family' => 'inet6' },
|
||||
'10.0.0.2' => { 'netmask' => '255.255.255.0', 'broadcast' => '10.0.0.255', 'family' => 'inet' },
|
||||
'08:00:27:CA:AB:08' => { 'family' => 'lladdr' }
|
||||
}
|
||||
},
|
||||
"lo" => {
|
||||
"addresses" => {
|
||||
"::1" => {"scope" => "Node", "prefixlen" => "128", "family" => "inet6"},
|
||||
"127.0.0.1" => {"netmask" => "255.0.0.0", "family" => "inet"}
|
||||
},
|
||||
},
|
||||
},
|
||||
'lo' => {
|
||||
'addresses' => {
|
||||
'::1' => { 'scope' => 'Node', 'prefixlen' => '128', 'family' => 'inet6' },
|
||||
'127.0.0.1' => { 'netmask' => '255.0.0.0', 'family' => 'inet' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def swift_stubs
|
||||
|
||||
stub_command("/usr/bin/id swift").and_return(true)
|
||||
stub_command("[ -x /etc/swift/pull-rings.sh ]").and_return(true)
|
||||
stub_command("[ -f /etc/rsyncd.conf ]").and_return(true)
|
||||
# TODO(chrislaco) Fixed in spec refactor
|
||||
def swift_stubs # rubocop:disable MethodLength
|
||||
stub_command('/usr/bin/id swift').and_return(true)
|
||||
stub_command('[ -x /etc/swift/pull-rings.sh ]').and_return(true)
|
||||
stub_command('[ -f /etc/rsyncd.conf ]').and_return(true)
|
||||
stub_command("grep -q 'RSYNC_ENABLE=false' /etc/default/rsync").and_return(true)
|
||||
stub_command("[ -e /etc/swift/account-server.conf ] && [ -e /etc/swift/account.ring.gz ]").and_return(true)
|
||||
stub_command("[ -e /etc/swift/container-server.conf ] && [ -e /etc/swift/container.ring.gz ]").and_return(true)
|
||||
stub_command("[ -e /etc/init/swift-container-sync.conf ]").and_return(false)
|
||||
stub_command("[ -e /etc/init.d/swift-container-sync ]").and_return(false)
|
||||
stub_command("[ -e /etc/swift/object-server.conf ] && [ -e /etc/swift/object.ring.gz ]").and_return(true)
|
||||
stub_command("[ -e /etc/swift/proxy-server.conf ] && [ -e /etc/swift/object.ring.gz ]").and_return(true)
|
||||
stub_command('[ -e /etc/swift/account-server.conf ] && [ -e /etc/swift/account.ring.gz ]').and_return(true)
|
||||
stub_command('[ -e /etc/swift/container-server.conf ] && [ -e /etc/swift/container.ring.gz ]').and_return(true)
|
||||
stub_command('[ -e /etc/init/swift-container-sync.conf ]').and_return(false)
|
||||
stub_command('[ -e /etc/init.d/swift-container-sync ]').and_return(false)
|
||||
stub_command('[ -e /etc/swift/object-server.conf ] && [ -e /etc/swift/object.ring.gz ]').and_return(true)
|
||||
stub_command('[ -e /etc/swift/proxy-server.conf ] && [ -e /etc/swift/object.ring.gz ]').and_return(true)
|
||||
|
||||
# create mock cluster
|
||||
n = Chef::Node.new()
|
||||
n = Chef::Node.new
|
||||
n.name('manager')
|
||||
n.default_attrs = {
|
||||
"swift" => {
|
||||
"service_pass" => "foobar"
|
||||
'swift' => {
|
||||
'service_pass' => 'foobar'
|
||||
}
|
||||
}
|
||||
Chef::Recipe.any_instance.stub(:search).with(:node, 'chef_environment:_default AND roles:swift-setup').and_return([n])
|
||||
Chef::Recipe.any_instance.stub(:search).with(:node, 'chef_environment:_default AND roles:swift-setup').and_return([n])
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-object-storage::storage-common' do
|
||||
@@ -6,7 +7,7 @@ describe 'openstack-object-storage::storage-common' do
|
||||
# UBUNTU
|
||||
#-------------------
|
||||
|
||||
describe "ubuntu" do
|
||||
describe 'ubuntu' do
|
||||
|
||||
before do
|
||||
swift_stubs
|
||||
@@ -14,43 +15,43 @@ describe 'openstack-object-storage::storage-common' do
|
||||
@node = @chef_run.node
|
||||
@node.set['lsb']['code'] = 'precise'
|
||||
@node.set['swift']['authmode'] = 'swauth'
|
||||
@chef_run.converge "openstack-object-storage::storage-common"
|
||||
@chef_run.converge 'openstack-object-storage::storage-common'
|
||||
end
|
||||
|
||||
describe "/var/cache/swift" do
|
||||
describe '/var/cache/swift' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.directory "/var/cache/swift"
|
||||
@file = @chef_run.directory '/var/cache/swift'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "700"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '700'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "/etc/swift/drive-audit.conf" do
|
||||
describe '/etc/swift/drive-audit.conf' do
|
||||
|
||||
before do
|
||||
@file = @chef_run.template "/etc/swift/drive-audit.conf"
|
||||
@file = @chef_run.template '/etc/swift/drive-audit.conf'
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file.owner).to eq("swift")
|
||||
expect(@file.group).to eq("swift")
|
||||
it 'has proper owner' do
|
||||
expect(@file.owner).to eq('swift')
|
||||
expect(@file.group).to eq('swift')
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "600"
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq '600'
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it 'template contents' do
|
||||
pending 'TODO: implement'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user