<commit_before>require 'spec_helper'

# Ensures that smartdc guest tools are installed
# Not included in sdc-vmtools which we began using in newer builds
if attr[:version].to_i  < 20140818
	describe file('/etc/acpi/events/powerbtn-acpi-support') do
  	it { should be_file }
  	it { should be_mode 644 }
	end

	describe file('/lib/smartdc/redhat-powerbtn-acpi-support.sh') do
  	it { should be_file }
  	it { should be_executable }
	end
end

describe file('/lib/smartdc') do
  it { should be_directory }
end


# Since 2.6.0 See IMAGE-446.
describe file('/lib/smartdc/firstboot') do
  it { should be_file }
  it { should be_executable }
end

# Since 2.6.0 See IMAGE-446.
# The VM should have already gone through the first boot process
# so this file should exists to prevent it running again see
# /lib/smartdc/joyent_rc.local
describe file('/lib/smartdc/.firstboot-complete-do-not-delete') do
  it { should be_file }
  it { should be_mode 644 }
end

describe file('/lib/smartdc/format-secondary-disk') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/joyent_rc.local') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/lib_smartdc_scripts.cfg') do
  it { should be_file }
end

describe file('/lib/smartdc/mdata-get') do
  it { should be_file }
  it { should be_executable }
	it { should be_linked_to '/usr/sbin/mdata-get' }
end

describe file('/lib/smartdc/run-operator-script') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/run-user-script') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/send-arp-updates') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/set-root-authorized-keys') do
  it { should be_file }
  it { should be_executable }
end

## Ensure the appropriate smartdc guest tools are run each boot
# First, make sure the appropriate symlink is there
describe file('/etc/rc.local') do
  it { should be_file }
  it { should be_executable }
  it { should be_linked_to '/etc/rc.d/rc.local' }
end

# Check to see if guest tools are run at boot

# Newer builds use sdc-vmtools
if attr[:version].to_i  < 20140818
	describe file('/etc/rc.d/rc.local') do
  	it { should be_file }
  	it { should be_executable }
		it { should contain "(/lib/smartdc/joyent_rc.local)" }
	end	
else
  describe file('/etc/rc.d/rc.local') do
    it { should be_file }
    it { should be_executable }
		it { should be_linked_to '/lib/smartdc/joyent_rc.local' }
	end
end

# Since 2.6.0 See IMAGE-426.
# Make sure new guest tools are installed
describe file('/usr/sbin/mdata-get') do
  it { should be_file }
	it { should be_executable }
end

describe file('/usr/sbin/mdata-list') do
  it { should be_file }<commit_msg>/etc/rc.local is always a symlink in CentOS, no need to test for it<commit_after>require 'spec_helper'

# Ensures that smartdc guest tools are installed
# Not included in sdc-vmtools which we began using in newer builds
if attr[:version].to_i  < 20140818
	describe file('/etc/acpi/events/powerbtn-acpi-support') do
  	it { should be_file }
  	it { should be_mode 644 }
	end

	describe file('/lib/smartdc/redhat-powerbtn-acpi-support.sh') do
  	it { should be_file }
  	it { should be_executable }
	end
end

describe file('/lib/smartdc') do
  it { should be_directory }
end


# Since 2.6.0 See IMAGE-446.
describe file('/lib/smartdc/firstboot') do
  it { should be_file }
  it { should be_executable }
end

# Since 2.6.0 See IMAGE-446.
# The VM should have already gone through the first boot process
# so this file should exists to prevent it running again see
# /lib/smartdc/joyent_rc.local
describe file('/lib/smartdc/.firstboot-complete-do-not-delete') do
  it { should be_file }
  it { should be_mode 644 }
end

describe file('/lib/smartdc/format-secondary-disk') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/joyent_rc.local') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/lib_smartdc_scripts.cfg') do
  it { should be_file }
end

describe file('/lib/smartdc/mdata-get') do
  it { should be_file }
  it { should be_executable }
	it { should be_linked_to '/usr/sbin/mdata-get' }
end

describe file('/lib/smartdc/run-operator-script') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/run-user-script') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/send-arp-updates') do
  it { should be_file }
  it { should be_executable }
end

describe file('/lib/smartdc/set-root-authorized-keys') do
  it { should be_file }
  it { should be_executable }
end

## Ensure the appropriate smartdc guest tools are run each boot

# Newer builds use sdc-vmtools
if attr[:version].to_i  < 20140818
	describe file('/etc/rc.d/rc.local') do
  	it { should be_file }
  	it { should be_executable }
		it { should contain "(/lib/smartdc/joyent_rc.local)" }
	end	
else
  describe file('/etc/rc.d/rc.local') do
    it { should be_file }
    it { should be_executable }
		it { should be_linked_to '/lib/smartdc/joyent_rc.local' }
	end
end

# Since 2.6.0 See IMAGE-426.
# Make sure new guest tools are installed
describe file('/usr/sbin/mdata-get') do
  it { should be_file }
	it { should be_executable }
end

describe file('/usr/sbin/mdata-list') do
  it { should be_file }
{'fraction_non_alphanumeric': 0.10930875576036866, 'fraction_numerical': 0.014746543778801843, 'mean_word_length': 3.5634987384356602, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '793530', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1896, 'n_words': 562}