Skip to content

Instantly share code, notes, and snippets.

@ogaty
Last active December 22, 2018 06:53
Show Gist options
  • Save ogaty/c6c74a07178eb7ff2f001c81d78d2b28 to your computer and use it in GitHub Desktop.
Save ogaty/c6c74a07178eb7ff2f001c81d78d2b28 to your computer and use it in GitHub Desktop.
serverspec
require 'spec_helper'

describe package('git') do
  it { should be_installed }
end

describe package('httpd') do
  it { should be_installed }
end

describe service('httpd') do
  it { should be_enabled }
  it { should be_running }
end

describe file('/etc/httpd/conf/httpd.conf') do
  its(:content) { should match /User tea/ }
end

describe package('php') do
  it { should be_installed }
end

describe package('php-mbstring') do
  it { should be_installed }
end

describe package('php-xml') do
  it { should be_installed }
end

describe package('php-pdo') do
  it { should be_installed }
end

describe package('php-mysqlnd') do
  it { should be_installed }
end

describe package('mod_ssl') do
  it { should be_installed }
end

describe 'PHP config' do
  context  php_config('date.timezone') do
   its(:value) { should eq 'Asia/Tokyo' }
  end
end

describe package('mariadb') do
  it { should be_installed }
end

describe service('mariadb') do
  it { should be_enabled }
  it { should be_running }
end

describe service('redis') do
  it { should be_enabled }
  it { should be_running }
end

describe file('/usr/local/bin/composer') do
  it { should exist }
end

describe file('/home/tea/.ssh/id_rsa.github') do
  it { should exist }
end

describe file('/key') do
  it { should exist }
end

describe file('/home/tea/.vimrc') do
  it { should exist }
end

describe file('/home/tea/.bash_alias') do
  it { should exist }
end

describe "swap" do
  describe command('swapon -s') do
    its(:stdout) { should match /\/swapfile/ }
  end
end

describe file('/share') do
  it { should be_mounted }
end

describe user('tea') do
  it { should exist }
end

describe package('etckeeper') do
  it { should be_installed }
end

describe file('/etc/.git') do
  it { should exist }
end

describe file('/swiss/swetest2') do
  it { should exist }
end

describe port(20123) do
  it { should be_listening }
end

describe file('/home/tea/.bashrc') do
  its(:content) { should match /LS_COLORS/ }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment