Skip to content

Commit

Permalink
Moved to the new version of Serverspec: v2
Browse files Browse the repository at this point in the history
Details can be found here:
 test-kitchen/test-kitchen#513
  • Loading branch information
ctapobep committed Oct 4, 2014
1 parent 064b549 commit 2554bd3
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ suites:
run_list:
- recipe[ark]
- recipe[jtalks::webapps]
- name: db
- name: databases
run_list:
- recipe[mysql::server]
- recipe[database::mysql]
Expand Down
9 changes: 4 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
source 'https://rubygems.org'

group :development do
gem 'test-kitchen'
gem 'kitchen-vagrant'
gem 'serverspec'
end

gem 'test-kitchen'
gem 'kitchen-vagrant'
gem 'serverspec', '2.0.1'
3 changes: 1 addition & 2 deletions test/integration/cicd/serverspec/cicd_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'serverspec'
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
set :backend, :exec

describe 'jtalks::cicd' do
it 'installs jtalks-cicd package' do
Expand Down
13 changes: 13 additions & 0 deletions test/integration/databases/serverspec/databases_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'serverspec'
set :backend, :exec

describe 'jtalks::databases' do
describe command("mysql -ujcommune -pjcommune -e 'select 1 from dual;'") do
its(:exit_status) { should eq 0 }
end

describe command('mysqldump -ujcommune -pjcommune jcommune > /dev/null') do
its(:exit_status) {should eq 0}
end

end
Empty file.
3 changes: 1 addition & 2 deletions test/integration/nginx/serverspec/nginx_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'serverspec'
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
set :backend, :exec

describe 'jtalks::jcommune' do
describe file('/etc/nginx/sites-available/jcommune') do
Expand Down
13 changes: 2 additions & 11 deletions test/integration/webapps/serverspec/webapps_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'serverspec'
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
set :backend, :exec

describe 'jtalks::jcommune' do
describe file('/home/jcommune/tomcat/conf/server.xml') do
Expand Down Expand Up @@ -35,7 +34,7 @@
describe file('/home/jcommune/.jtalks/environments/chef/jcommune.xml') do
it { should be_owned_by 'jcommune' }
it { should be_mode 600 }
its(:content) { should include 'name="EH_CACHE_CONFIG" value="/home/jcommune/tomcat/conf/jcommune.ehcache.xml"' }
its(:content) { should include 'name="EH_CACHE_CONFIG" value="file:/home/jcommune/tomcat/conf/jcommune.ehcache.xml"' }
its(:content) { should include 'name="JCOMMUNE_DB_USER" value="jcommune"' }
its(:content) { should include 'name="JCOMMUNE_DB_PASSWORD" value="jcommune"' }
its(:content) { should include 'value="jdbc:mysql://localhost/jcommune?characterEncoding=UTF-8"' }
Expand All @@ -45,14 +44,6 @@
its(:content) { should include 'name="spring.profiles.active" value="performance"' }
end

it('creates jcommune db user') do
expect(command("mysql -ujcommune -pjcommune -e 'select 1 from dual;'")).to return_exit_status(0)
end

it('creates jcommune db with permissions granted to jcommune user') do
expect(command('mysqldump -ujcommune -pjcommune jcommune > /dev/null')).to return_exit_status(0)
end

it('sets x flag to .sh scripts in tomcat dir') do
tomcat_bin = '/home/jcommune/tomcat/bin'
expect(file("#{tomcat_bin}/startup.sh")).to be_mode 744
Expand Down

0 comments on commit 2554bd3

Please sign in to comment.