Browse Source

Add tests for the repositories state file

tags/v0.7.0
Javier Bértoli 8 years ago
parent
commit
c0b6c245d8
3 changed files with 89 additions and 0 deletions
  1. +45
    -0
      .kitchen.yml
  2. +35
    -0
      test/integration/repositories/serverspec/repositories_spec.rb
  3. +9
    -0
      test/integration/repositories/serverspec/spec_helper.rb

+ 45
- 0
.kitchen.yml View File

@@ -0,0 +1,45 @@
---
driver:
name: vagrant

platforms:
- name: debian-jessie64
driver_config:
box: ssplatt/salt-deb-8

provisioner:
name: salt_solo
salt_version: 2015.8.8
is_file_root: true
grains:
os_family: Debian

suites:
- name: repositories
provisioner:
state_top:
base:
'*':
- apt.repositories
- apt.update
pillars:
top.sls:
base:
'*':
- apt
apt.sls:
apt:
remove_sources_list: true
clean_sources_list_d: true
repositories:
debian-jessie-source:
distro: jessie
url: http://httpredir.debian.org/debian
type: [source]
comps: [main, contrib, non-free]
dropbox-repo:
distro: jessie
url: http://linux.dropbox.com/debian
arch: [i386, amd64]
keyid: 1C61A2656FB57B7E4DE0F4C1FC918B335044912E
keyserver: pgp.mit.edu

+ 35
- 0
test/integration/repositories/serverspec/repositories_spec.rb View File

@@ -0,0 +1,35 @@
require 'spec_helper'

describe 'apt.repositories' do

describe package('debian-archive-keyring') do
it { should be_installed }
end

describe file('/etc/apt/sources.list') do
it { should_not exist }
end

describe file('/etc/apt/sources.list.d') do
it { should be_directory }
it { should be_mode 755 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end

describe file('/etc/apt/sources.list.d/debian-jessie-source.list') do
it { should exist }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should match('deb-src http://httpredir.debian.org/debian jessie contrib non-free main') }
end

describe file('/etc/apt/sources.list.d/dropbox-repo.list') do
it { should exist }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should match(%r{deb \[arch=i386,amd64\] http://linux.dropbox.com/debian jessie main}) }
end
end

+ 9
- 0
test/integration/repositories/serverspec/spec_helper.rb View File

@@ -0,0 +1,9 @@
require "serverspec"
require "pathname"

# Set backend type
set :backend, :exec

RSpec.configure do |c|
c.path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
end

Loading…
Cancel
Save