From c5e28eb5f66dd86d3187b489cf59f38cd990c5b1 Mon Sep 17 00:00:00 2001 From: Vincent Durand Date: Wed, 21 Nov 2018 17:36:29 +0100 Subject: [PATCH] Fix integration tests --- .kitchen.yml | 25 +++++--- .../serverspec/chruby_build_spec.rb | 60 +++++++++---------- .../serverspec/spec_helper.rb | 2 +- .../{ruby-2.3.4.json => ruby-2.5.3.json} | 6 +- .../serverspec/chruby_build_spec.rb | 60 ++++++++++++------- .../serverspec/spec_helper.rb | 2 +- 6 files changed, 85 insertions(+), 70 deletions(-) rename test/integration/rubies_data_bags/data_bags/rubies/{ruby-2.3.4.json => ruby-2.5.3.json} (52%) diff --git a/.kitchen.yml b/.kitchen.yml index f0188ca..359f4dc 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -3,19 +3,25 @@ driver: name: vagrant provisioner: - name: chef_solo - solo_rb: - ssl_verify_mode: verify_peer + name: chef_zero + install_strategy: always platforms: - name: ubuntu-12.04 - name: ubuntu-14.04 - name: ubuntu-16.04 - - name: ubuntu-16.04-chef-12 + - name: ubuntu-14.04-chef-13 driver: - box: bento/ubuntu-16.04 + box: bento/ubuntu-14.04 provisioner: - require_chef_omnibus: 12.21.3 + product_name: chef + product_version: 13 + - name: ubuntu-18.04-chef-14 + driver: + box: bento/ubuntu-18.04 + provisioner: + product_name: chef + product_version: 14 suites: - name: default @@ -43,8 +49,9 @@ suites: libyaml: enable: false rubies: - - id: "ruby-2.4.1" - url: "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz" + - id: "ruby-2.4.5" + url: "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.5.tar.gz" + checksum: "6737741ae6ffa61174c8a3dcdd8ba92bc38827827ab1d7ea1ec78bc3cefc5198" gems: - - bundler + - bundler 1.17.1 - pry diff --git a/test/integration/rubies_attributes/serverspec/chruby_build_spec.rb b/test/integration/rubies_attributes/serverspec/chruby_build_spec.rb index a1df25b..5e8fa31 100644 --- a/test/integration/rubies_attributes/serverspec/chruby_build_spec.rb +++ b/test/integration/rubies_attributes/serverspec/chruby_build_spec.rb @@ -42,55 +42,49 @@ it { is_expected.to be_installed } end -describe file('/opt/rubies/ruby-2.4.1') do +describe file('/opt/rubies/ruby-2.4.5') do it { is_expected.to be_directory } it { is_expected.to be_owned_by 'root' } end -describe command('/usr/local/bin/chruby-exec ruby-2.4.1 -- ruby -r rbconfig -e \'print RbConfig::CONFIG["configure_args"]\'') do - its(:stdout) { is_expected.to eq " '--disable-install-doc' '--enable-shared' '--with-opt-dir=/usr/local' '--prefix=/opt/rubies/ruby-2.4.1'" } -end +describe "ruby-2.4.5" do + before { command('chruby ruby-2.4.5') } -describe command('/usr/local/bin/chruby-exec ruby-2.4.1 -- ruby -e \'print RUBY_VERSION\'') do - its(:stdout) { is_expected.to eq "2.4.1" } -end + describe command('ruby -r rbconfig -e \'print RbConfig::CONFIG["configure_args"]\'') do + its(:stdout) { is_expected.to eq " '--disable-install-doc' '--enable-shared' '--with-opt-dir=/usr/local' '--prefix=/opt/rubies/ruby-2.4.5'" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.4.1 -- ruby -r yaml -e \'print Psych::LIBYAML_VERSION\''), if: os[:release] == '12.04' do - its(:stdout) { is_expected.to eq "0.1.4" } -end + describe command('ruby -e \'print RUBY_VERSION\'') do + its(:stdout) { is_expected.to eq "2.4.5" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.4.1 -- ruby -r yaml -e \'print Psych::LIBYAML_VERSION\''), if: os[:release] == '14.04' do - its(:stdout) { is_expected.to eq "0.1.4" } -end + if os[:release] == '18.04' + describe command('ruby -r yaml -e \'print Psych::LIBYAML_VERSION\'') do + its(:stdout) { is_expected.to eq "0.1.7" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.4.1 -- ruby -r yaml -e \'print Psych::LIBYAML_VERSION\''), if: os[:release] == '16.04' do - its(:stdout) { is_expected.to eq "0.1.6" } -end + describe command('ruby -r openssl -e \'print OpenSSL::OPENSSL_LIBRARY_VERSION\'') do + its(:stdout) { is_expected.to eq "OpenSSL 1.1.0g 2 Nov 2017" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r readline -e \'print Readline::VERSION\''), if: os[:release] == '12.04' do - its(:stdout) { is_expected.to eq "6.2" } -end + describe command('ruby -r readline -e \'print Readline::VERSION\'') do + its(:stdout) { is_expected.to eq "7.0" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r readline -e \'print Readline::VERSION\''), if: os[:release] == '14.04' do - its(:stdout) { is_expected.to eq "6.3" } + describe command('ruby -r zlib -e \'print Zlib::ZLIB_VERSION\'') do + its(:stdout) { is_expected.to eq "1.2.11" } + end + end end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r readline -e \'print Readline::VERSION\''), if: os[:release] == '16.04' do - its(:stdout) { is_expected.to eq "6.3" } -end - -describe command('/usr/local/bin/chruby-exec ruby-2.4.1 -- ruby -r openssl -e \'print OpenSSL::VERSION\'') do - its(:stdout) { is_expected.to eq "2.0.3" } -end - -describe file('/opt/rubies/ruby-2.4.1/etc/gemrc') do +describe file('/opt/rubies/ruby-2.4.5/etc/gemrc') do it { is_expected.to be_file } it { is_expected.to be_owned_by 'root' } it { is_expected.to be_mode 644 } end describe package('bundler') do - it { is_expected.to be_installed.by('gem') } + it { is_expected.to be_installed.by('gem').with_version('1.17.1') } end describe package('pry') do @@ -98,9 +92,9 @@ end describe command('which bundle') do - its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.4.1/bin/bundle\n" } + its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.4.5/bin/bundle\n" } end describe command('which pry') do - its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.4.1/bin/pry\n" } + its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.4.5/bin/pry\n" } end diff --git a/test/integration/rubies_attributes/serverspec/spec_helper.rb b/test/integration/rubies_attributes/serverspec/spec_helper.rb index b397be8..dc65b5d 100644 --- a/test/integration/rubies_attributes/serverspec/spec_helper.rb +++ b/test/integration/rubies_attributes/serverspec/spec_helper.rb @@ -1,4 +1,4 @@ require 'serverspec' set :backend, :exec -set :path, '$PATH:/sbin:/usr/sbin:/opt/rubies/ruby-2.4.1/bin' +set :path, '$PATH:/sbin:/usr/sbin:/opt/rubies/ruby-2.4.5/bin' diff --git a/test/integration/rubies_data_bags/data_bags/rubies/ruby-2.3.4.json b/test/integration/rubies_data_bags/data_bags/rubies/ruby-2.5.3.json similarity index 52% rename from test/integration/rubies_data_bags/data_bags/rubies/ruby-2.3.4.json rename to test/integration/rubies_data_bags/data_bags/rubies/ruby-2.5.3.json index cd77237..29c4a11 100644 --- a/test/integration/rubies_data_bags/data_bags/rubies/ruby-2.3.4.json +++ b/test/integration/rubies_data_bags/data_bags/rubies/ruby-2.5.3.json @@ -1,7 +1,7 @@ { - "id": "ruby-2.3.4", - "url": "https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.4.tar.gz", - "checksum": "98e18f17c933318d0e32fed3aea67e304f174d03170a38fd920c4fbe49fec0c3", + "id": "ruby-2.5.3", + "url": "https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.gz", + "checksum": "9828d03852c37c20fa333a0264f2490f07338576734d910ee3fd538c9520846c", "gems": ["bundler 1.17.1", "pry"], "environment": { "ARCHFLAGS": "-arch x86_64", diff --git a/test/integration/rubies_data_bags/serverspec/chruby_build_spec.rb b/test/integration/rubies_data_bags/serverspec/chruby_build_spec.rb index dc30d4c..711f49d 100644 --- a/test/integration/rubies_data_bags/serverspec/chruby_build_spec.rb +++ b/test/integration/rubies_data_bags/serverspec/chruby_build_spec.rb @@ -34,6 +34,10 @@ it { is_expected.to be_installed } end +describe package('libunwind8'), if: os[:release] == '18.04' do + it { is_expected.to be_installed } +end + describe package('g++') do it { is_expected.to be_installed } end @@ -62,49 +66,59 @@ it { is_expected.to be_installed } end -describe file('/opt/rubies/ruby-2.3.4') do +describe file('/opt/rubies/ruby-2.5.3') do it { is_expected.to be_directory } it { is_expected.to be_owned_by 'root' } end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r rbconfig -e \'print RbConfig::CONFIG["configure_args"]\'') do - its(:stdout) { is_expected.to eq " '--disable-install-doc' '--enable-shared' '--with-opt-dir=/usr/local' '--prefix=/opt/rubies/ruby-2.3.4' 'CFLAGS=-g -O2' 'LIBS=-ltcmalloc_minimal -lyaml' 'CPPFLAGS=-I/usr/include -I/usr/local/include'" } -end +describe "ruby-2.5.3" do + before { command('chruby ruby-2.5.3') } -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -e \'print RUBY_VERSION\'') do - its(:stdout) { is_expected.to eq "2.3.4" } -end + describe command('ruby -r rbconfig -e \'print RbConfig::CONFIG["configure_args"]\'') do + its(:stdout) { is_expected.to eq " '--disable-install-doc' '--enable-shared' '--with-opt-dir=/usr/local' '--prefix=/opt/rubies/ruby-2.5.3' 'CFLAGS=-g -O2' 'LIBS=-ltcmalloc_minimal -lyaml' 'CPPFLAGS=-I/usr/include -I/usr/local/include'" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r yaml -e \'print Psych::LIBYAML_VERSION\'') do - its(:stdout) { is_expected.to eq "0.1.7" } -end + describe command('ruby -e \'print RUBY_VERSION\'') do + its(:stdout) { is_expected.to eq "2.5.3" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r readline -e \'print Readline::VERSION\''), if: os[:release] == '12.04' do - its(:stdout) { is_expected.to eq "6.2" } -end + if os[:release] == '18.04' + describe command('ruby -r yaml -e \'print Psych::LIBYAML_VERSION\'') do + its(:stdout) { is_expected.to eq "0.2.1" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r readline -e \'print Readline::VERSION\''), if: os[:release] == '14.04' do - its(:stdout) { is_expected.to eq "6.3" } -end + describe command('ruby -r openssl -e \'print OpenSSL::OPENSSL_LIBRARY_VERSION\'') do + its(:stdout) { is_expected.to eq "OpenSSL 1.1.0g 2 Nov 2017" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r readline -e \'print Readline::VERSION\''), if: os[:release] == '16.04' do - its(:stdout) { is_expected.to eq "6.3" } -end + describe command('ruby -r readline -e \'print Readline::VERSION\'') do + its(:stdout) { is_expected.to eq "7.0" } + end -describe command('/usr/local/bin/chruby-exec ruby-2.3.4 -- ruby -r openssl -e \'print OpenSSL::VERSION\'') do - its(:stdout) { is_expected.to eq "1.1.0" } + describe command('ruby -r zlib -e \'print Zlib::ZLIB_VERSION\'') do + its(:stdout) { is_expected.to eq "1.2.11" } + end + end end -describe file('/opt/rubies/ruby-2.3.4/etc/gemrc') do +describe file('/opt/rubies/ruby-2.5.3/etc/gemrc') do it { is_expected.to be_file } it { is_expected.to be_owned_by 'root' } it { is_expected.to be_mode 644 } end describe package('bundler') do + it { is_expected.to be_installed.by('gem').with_version('1.17.1') } +end + +describe package('pry') do it { is_expected.to be_installed.by('gem') } end describe command('which bundle') do - its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.3.4/bin/bundle\n" } + its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.5.3/bin/bundle\n" } +end + +describe command('which pry') do + its(:stdout) { is_expected.to eq "/opt/rubies/ruby-2.5.3/bin/pry\n" } end diff --git a/test/integration/rubies_data_bags/serverspec/spec_helper.rb b/test/integration/rubies_data_bags/serverspec/spec_helper.rb index e9403ec..56ff4f4 100644 --- a/test/integration/rubies_data_bags/serverspec/spec_helper.rb +++ b/test/integration/rubies_data_bags/serverspec/spec_helper.rb @@ -1,4 +1,4 @@ require 'serverspec' set :backend, :exec -set :path, '$PATH:/sbin:/usr/sbin:/opt/rubies/ruby-2.3.4/bin' +set :path, '$PATH:/sbin:/usr/sbin:/opt/rubies/ruby-2.5.3/bin'