From 2554bd3dd590c6739f34e917e384ed73d1195e98 Mon Sep 17 00:00:00 2001 From: ctapobep Date: Sun, 5 Oct 2014 01:23:58 +0400 Subject: [PATCH] Moved to the new version of Serverspec: v2 Details can be found here: https://github.com/test-kitchen/test-kitchen/issues/513 --- .kitchen.yml | 2 +- Gemfile | 9 ++++----- test/integration/cicd/serverspec/cicd_spec.rb | 3 +-- .../databases/serverspec/databases_spec.rb | 13 +++++++++++++ test/integration/firewall/firewall_spec.rb | 0 test/integration/nginx/serverspec/nginx_spec.rb | 3 +-- test/integration/webapps/serverspec/webapps_spec.rb | 13 ++----------- 7 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 test/integration/databases/serverspec/databases_spec.rb delete mode 100644 test/integration/firewall/firewall_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 24e63b0..53e85dc 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -32,7 +32,7 @@ suites: run_list: - recipe[ark] - recipe[jtalks::webapps] - - name: db + - name: databases run_list: - recipe[mysql::server] - recipe[database::mysql] diff --git a/Gemfile b/Gemfile index 44183df..edd984e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source 'https://rubygems.org' -group :development do - gem 'test-kitchen' - gem 'kitchen-vagrant' - gem 'serverspec' -end \ No newline at end of file + +gem 'test-kitchen' +gem 'kitchen-vagrant' +gem 'serverspec', '2.0.1' \ No newline at end of file diff --git a/test/integration/cicd/serverspec/cicd_spec.rb b/test/integration/cicd/serverspec/cicd_spec.rb index fcb0eee..7f359da 100644 --- a/test/integration/cicd/serverspec/cicd_spec.rb +++ b/test/integration/cicd/serverspec/cicd_spec.rb @@ -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 diff --git a/test/integration/databases/serverspec/databases_spec.rb b/test/integration/databases/serverspec/databases_spec.rb new file mode 100644 index 0000000..a6d8322 --- /dev/null +++ b/test/integration/databases/serverspec/databases_spec.rb @@ -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 \ No newline at end of file diff --git a/test/integration/firewall/firewall_spec.rb b/test/integration/firewall/firewall_spec.rb deleted file mode 100644 index e69de29..0000000 diff --git a/test/integration/nginx/serverspec/nginx_spec.rb b/test/integration/nginx/serverspec/nginx_spec.rb index 187fc76..70ac1f3 100644 --- a/test/integration/nginx/serverspec/nginx_spec.rb +++ b/test/integration/nginx/serverspec/nginx_spec.rb @@ -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 diff --git a/test/integration/webapps/serverspec/webapps_spec.rb b/test/integration/webapps/serverspec/webapps_spec.rb index 7e53b7e..d95fff5 100644 --- a/test/integration/webapps/serverspec/webapps_spec.rb +++ b/test/integration/webapps/serverspec/webapps_spec.rb @@ -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 @@ -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"' } @@ -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