summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2016-02-10 14:45:53 -0800
committerJohn Keiser <john@johnkeiser.com>2016-02-10 15:07:18 -0800
commitdaf010ed1549617cae8878ca0abbe37ab2a4719f (patch)
tree9c9c5ed99fe4906c8c307a40c4bf83baf5886905
parentcd96a4a386e7da079061b60923b98abc7f8e74f5 (diff)
downloadchef-daf010ed1549617cae8878ca0abbe37ab2a4719f.tar.gz
Respect TMPDIR in functional tests
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb6
-rw-r--r--spec/functional/resource/bff_spec.rb8
-rw-r--r--spec/functional/resource/rpm_spec.rb8
-rw-r--r--spec/functional/run_lock_spec.rb2
-rw-r--r--spec/scripts/ssl-serve.rb2
5 files changed, 13 insertions, 13 deletions
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 92ddb52c33..bf50046b03 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -29,11 +29,11 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
# Platform specific validation routines.
def service_should_be_started(file_name)
# The existence of this file indicates that the service was started.
- expect(File.exists?("/tmp/#{file_name}")).to be_truthy
+ expect(File.exists?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
end
def service_should_be_stopped(file_name)
- expect(File.exists?("/tmp/#{file_name}")).to be_falsey
+ expect(File.exists?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
end
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
@@ -51,7 +51,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
end
def delete_test_files
- files = Dir.glob("/tmp/chefinit[a-z_]*.txt")
+ files = Dir.glob("#{Dir.tmpdir}/chefinit[a-z_]*.txt")
File.delete(*files)
end
diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb
index 3a1d5840e8..e7f7540e5a 100644
--- a/spec/functional/resource/bff_spec.rb
+++ b/spec/functional/resource/bff_spec.rb
@@ -41,7 +41,7 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
before(:all) do
@pkg_name = "PkgA.rte"
- @pkg_path = "/tmp/PkgA.1.0.0.0.bff"
+ @pkg_path = "#{Dir.tmpdir}/PkgA.1.0.0.0.bff"
FileUtils.cp "spec/functional/assets/PkgA.1.0.0.0.bff" , @pkg_path
end
@@ -69,14 +69,14 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
after(:each) do
shell_out("installp -u #{@pkg_name}")
- FileUtils.rm "/tmp/installp.log"
+ FileUtils.rm "#{Dir.tmpdir}/installp.log"
end
end
context "package upgrade action" do
before(:each) do
shell_out("installp -aYF -d #{@pkg_path} #{@pkg_name}")
- @pkg_path = "/tmp/PkgA.2.0.0.0.bff"
+ @pkg_path = "#{Dir.tmpdir}/PkgA.2.0.0.0.bff"
FileUtils.cp "spec/functional/assets/PkgA.2.0.0.0.bff" , @pkg_path
end
@@ -114,7 +114,7 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
end
after(:each) do
- FileUtils.rm "/tmp/installp.log"
+ FileUtils.rm "#{Dir.tmpdir}/installp.log"
end
end
end
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index 6da74ead5f..5e68c70d39 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -60,12 +60,12 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
when "aix"
@pkg_name = "dummy"
@pkg_version = "1-0"
- @pkg_path = "/tmp/dummy-1-0.aix6.1.noarch.rpm"
+ @pkg_path = "#{Dir.tmpdir}/dummy-1-0.aix6.1.noarch.rpm"
FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "dummy-1-0.aix6.1.noarch.rpm") , @pkg_path)
when "centos", "redhat", "suse"
@pkg_name = "mytest"
@pkg_version = "1.0-1"
- @pkg_path = "/tmp/mytest-1.0-1.noarch.rpm"
+ @pkg_path = "#{Dir.tmpdir}/mytest-1.0-1.noarch.rpm"
FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "mytest-1.0-1.noarch.rpm") , @pkg_path)
end
end
@@ -101,11 +101,11 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
shell_out("rpm -i #{@pkg_path}")
if ohai[:platform] == "aix"
@pkg_version = "2-0"
- @pkg_path = "/tmp/dummy-2-0.aix6.1.noarch.rpm"
+ @pkg_path = "#{Dir.tmpdir}/dummy-2-0.aix6.1.noarch.rpm"
FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "dummy-2-0.aix6.1.noarch.rpm") , @pkg_path)
else
@pkg_version = "2.0-1"
- @pkg_path = "/tmp/mytest-2.0-1.noarch.rpm"
+ @pkg_path = "#{Dir.tmpdir}/mytest-2.0-1.noarch.rpm"
FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "mytest-2.0-1.noarch.rpm") , @pkg_path)
end
end
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index 288341bcb6..d380b19dc8 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -28,7 +28,7 @@ describe Chef::RunLock do
let(:random_temp_root) do
Kernel.srand(Time.now.to_i + Process.pid)
- "/tmp/#{Kernel.rand(Time.now.to_i + Process.pid)}"
+ "#{Dir.tmpdir}/#{Kernel.rand(Time.now.to_i + Process.pid)}"
end
let(:lockfile) { "#{random_temp_root}/this/long/path/does/not/exist/chef-client-running.pid" }
diff --git a/spec/scripts/ssl-serve.rb b/spec/scripts/ssl-serve.rb
index 284c58aa78..c05aa2c285 100644
--- a/spec/scripts/ssl-serve.rb
+++ b/spec/scripts/ssl-serve.rb
@@ -34,7 +34,7 @@ DEFAULT_OPTIONS = {
:Host => "localhost",
:environment => :none,
:Logger => LOGGER,
- :DocumentRoot => File.expand_path("/tmp/chef-118-sampledata")
+ :DocumentRoot => File.expand_path("#{Dir.tmpdir}/chef-118-sampledata")
#:AccessLog => [] # Remove this option to enable the access log when debugging.
}