<commit_before>require_relative 'spec_helper'

describe file('/var/lib/cloud/scripts/per-once/regenerate-machine-id') do
  it { should be_file }
end

describe file('/var/lib/cloud/scripts/per-once/resizefs') do
  it { should be_file }
end

describe file('/var/lib/cloud/seed/nocloud-net/user-data') do
  it { should be_linked_to '/boot/user-data' }
end

describe file('/var/lib/cloud/seed/nocloud-net/meta-data') do
  it { should be_linked_to '/boot/meta-data' }
end<commit_msg>Update cloud-init tests to run in mounted SD image<commit_after>require_relative 'spec_helper'

describe "cloud-init" do
  context "/var/lib/cloud/scripts/per-once" do
    let(:stdout) { run("ls -1 /var/lib/cloud/scripts/per-once").stdout }

    it "has a regenerate-machine-id script" do
      expect(stdout).to contain('regenerate-machine-id')
    end

    it "has a resize2fs script" do
      expect(stdout).to contain('resize2fs')
    end
  end

  context "/var/lib/cloud/seed/nocloud-net" do
    let(:stdout) { run_mounted("ls -l /var/lib/cloud/seed/nocloud-net").stdout }

    it "user-data is linked to /boot/user-data" do
      expect(stdout).to contain('user-data -> /boot/user-data')
    end

    it "meta-data is linked to /boot/meta-data" do
      expect(stdout).to contain('meta-data -> /boot/meta-data')
    end
  end
end
{'fraction_non_alphanumeric': 0.1447067783701447, 'fraction_numerical': 0.002284843869002285, 'mean_word_length': 3.3946488294314383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6516175', 'n_tokens_mistral': 468, 'n_tokens_neox': 454, 'n_words': 101}