<commit_before>require 'spec_helper'

# Ensure root password is set and password matches value in metadata
# Need to somehow validate that it's not the same as livecd and that
# it matches value from mdata-get

# Make sure default live-build password is not set
# We want to explicitly test for this first to ensure the default password from
# the live-build is not leaking through.
describe command("cat /etc/shadow | grep root | awk -F':' '{print $2;}'") do
  it { should_not return_stdout "$1$qHFOhAjw$AjgoyfS8u32uqV8qsL1r70" }
end

# Make sure no password is set
describe command("cat /etc/shadow | grep root | awk -F':' '{print $2;}'") do
  it { should return_stdout "" }
end

# Make sure ssh login is via ssh key only. This is required since we are enabling
# a password for root per IMAGE-459
describe file('/etc/ssh/sshd_config') do
  it { should be_file }
  it { should contain "PasswordAuthentication no" }
end
<commit_msg>Update test to ensure a root password is set. IMAGE-459<commit_after>require 'spec_helper'

# Ensure root password is set and password matches value in metadata
# Need to somehow validate that it's not the same as livecd and that
# it matches value from mdata-get

# Make sure default live-build password is not set
# We want to explicitly test for this first to ensure the default password from
# the live-build is not leaking through.
describe command("cat /etc/shadow | grep root | awk -F':' '{print $2;}'") do
  it { should_not return_stdout "$1$qHFOhAjw$AjgoyfS8u32uqV8qsL1r70" }
end

# Make sure a password is set IMAGE-459
describe command("cat /etc/shadow | grep root | awk -F':' '{print $2;}'") do
  it { should_not return_stdout "" }
end

# Make sure ssh login is via ssh key only. This is required since we are enabling
# a password for root per IMAGE-459
describe file('/etc/ssh/sshd_config') do
  it { should be_file }
  it { should contain "PasswordAuthentication no" }
end

{'fraction_non_alphanumeric': 0.08589276418532014, 'fraction_numerical': 0.01665799062988027, 'mean_word_length': 4.2228260869565215, 'pattern_counts': {'":': 0, '<': 3, '<?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': '900481', 'n_tokens_mistral': 614, 'n_tokens_neox': 575, 'n_words': 266}