Changes to cleanup tests files which are created during the test execution
This commit is contained in:
Родитель
e9ffe00b6f
Коммит
fbaebc2105
1
Rakefile
1
Rakefile
|
@ -24,7 +24,6 @@ require 'rspec/core'
|
|||
require 'rspec/core/rake_task'
|
||||
RSpec::Core::RakeTask.new(:spec) do |spec|
|
||||
spec.pattern = FileList['spec/unit/**/*_spec.rb']
|
||||
touch "AzureLinuxCert.pem"
|
||||
end
|
||||
|
||||
RSpec::Core::RakeTask.new(:functional) do |spec|
|
||||
|
|
|
@ -20,27 +20,34 @@ require 'fileutils'
|
|||
require "securerandom"
|
||||
require 'knife-azure/version'
|
||||
|
||||
|
||||
|
||||
#Create an empty mock certificate file
|
||||
FileUtils.touch('AzureLinuxCert.pem')
|
||||
|
||||
def tmpFile filename
|
||||
tmpdir = 'tmp'
|
||||
Dir::mkdir tmpdir unless FileTest::directory?(tmpdir)
|
||||
tmpdir + '/' + filename
|
||||
Dir::mkdir @tmpdir unless FileTest::directory?(@tmpdir)
|
||||
@tmpdir + '/' + filename
|
||||
end
|
||||
|
||||
Chef::Log.init(tmpFile('debug.log'), 'daily')
|
||||
Chef::Log.level=:debug
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.before(:each) { Chef::Config[:knife].each do |key, value| Chef::Config[:knife].delete(key) end }
|
||||
|
||||
c.before(:all) do
|
||||
#Create an empty mock certificate file
|
||||
@cert_file = 'AzureLinuxCert.pem'
|
||||
FileUtils.touch(@cert_file)
|
||||
|
||||
@tmpdir = 'tmp'
|
||||
Chef::Log.init(tmpFile('debug.log'), 'daily')
|
||||
Chef::Log.level=:debug
|
||||
end
|
||||
|
||||
c.after(:all) do
|
||||
#Cleanup files and dirs
|
||||
FileUtils.rm_rf(@cert_file)
|
||||
FileUtils.rm_rf(@tmpdir)
|
||||
end
|
||||
end
|
||||
|
||||
TEST_PARAMS = {
|
||||
:azure_subscription_id => "YOUR_SUBSCRIPTION_ID_HERE",
|
||||
:azure_mgmt_cert => "AzureLinuxCert.pem",
|
||||
:azure_mgmt_cert => @cert_file,
|
||||
:azure_api_host_name => "management-preview.core.windows-int.net",
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe Chef::Knife::AzureBase do
|
|||
@dummy = Chef::Knife::DummyClass.new
|
||||
Chef::Config[:knife][:azure_api_host_name] = 'preview.core.windows-int.net'
|
||||
Chef::Config[:knife][:azure_subscription_id] = 'azure_subscription_id'
|
||||
Chef::Config[:knife][:azure_mgmt_cert] = 'AzureLinuxCert.pem'
|
||||
Chef::Config[:knife][:azure_mgmt_cert] = @cert_file
|
||||
@dummy.ui.stub(:error)
|
||||
end
|
||||
describe "azure base tests - " do
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Chef::Knife::AzureImageList do
|
|||
@server_instance = Chef::Knife::AzureImageList.new
|
||||
{
|
||||
:azure_subscription_id => 'azure_subscription_id',
|
||||
:azure_mgmt_cert => 'AzureLinuxCert.pem',
|
||||
:azure_mgmt_cert => @cert_file,
|
||||
:azure_api_host_name => 'preview.core.windows-int.net',
|
||||
:azure_service_location => 'West Europe',
|
||||
:azure_source_image => 'SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120521-en-us-30GB.vhd',
|
||||
|
|
|
@ -19,7 +19,7 @@ before do
|
|||
|
||||
{
|
||||
:azure_subscription_id => 'azure_subscription_id',
|
||||
:azure_mgmt_cert => 'AzureLinuxCert.pem',
|
||||
:azure_mgmt_cert => @cert_file,
|
||||
:azure_api_host_name => 'preview.core.windows-int.net',
|
||||
:azure_service_location => 'West Europe',
|
||||
:azure_source_image => 'SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120521-en-us-30GB.vhd',
|
||||
|
|
|
@ -10,7 +10,7 @@ before do
|
|||
|
||||
{
|
||||
:azure_subscription_id => 'azure_subscription_id',
|
||||
:azure_mgmt_cert => 'AzureLinuxCert.pem',
|
||||
:azure_mgmt_cert => @cert_file,
|
||||
:azure_api_host_name => 'preview.core.windows-int.net',
|
||||
:name => 'vm01',
|
||||
:azure_service_location => 'West Europe',
|
||||
|
|
Загрузка…
Ссылка в новой задаче