Update inspec tests to manage RVM usage in different distros
[arvados-formula.git] / test / integration / api / controls / packages_spec.rb
index 9cb60abb11b65ab554b56d7adfcaeeabf7a806b8..969bf0752f16052d8ac2d5c28d68cd163a2ed002 100644 (file)
@@ -1,4 +1,5 @@
 # frozen_string_literal: true
+
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
 # SPDX-License-Identifier: Apache-2.0
@@ -11,15 +12,7 @@ control 'arvados api package' do
   end
 end
 
-control 'arvados cli gem' do
-  title 'should be installed'
-
-  describe gem('arvados-cli') do
-    it { should be_installed }
-  end
-end
-
-control 'RVM and dependencies' do
+control 'RVM dependencies' do
   title 'should be installed'
 
   only_if("Forced requirement for RedHat's family") do
@@ -27,19 +20,18 @@ control 'RVM and dependencies' do
   end
 
   %w[
-    rubygem-bundler
+    centos-release-scl
     curl
     gcc
     git
     libcurl
     libcurl-devel
-    pam-devel
-    postgresql-devel
     libxml2
     libxml2-devel
     make
+    pam-devel
+    postgresql12-libs
     python3-devel
-    ruby-devel
     zlib-devel
   ].each do |p|
     describe package(p) do
@@ -47,3 +39,43 @@ control 'RVM and dependencies' do
     end
   end
 end
+
+control 'RVM ruby manager' do
+  title 'should be installed'
+
+  only_if('Forced requirement for Centos-7 and Ubuntu-18.04') do
+    (os.redhat? and platform[:release].to_f.truncate == 7) or
+      (os.name == 'ubuntu' and platform[:release].to_f.truncate == 18)
+  end
+
+  describe command('/usr/local/rvm/bin/rvm list') do
+    its(:exit_status) { should eq 0 }
+    its('stdout') { should match(/ruby-2.7.2/) }
+  end
+end
+
+control 'arvados cli gem' do
+  title 'should be installed'
+
+  only_if('Skipped in Centos-7 and Ubuntu-18.04') do
+    !((os.redhat? and platform[:release].to_f.truncate == 7) or
+    (os.name == 'ubuntu' and platform[:release].to_f.truncate == 18))
+  end
+
+  describe gem('arvados-cli') do
+    it { should be_installed }
+  end
+end
+
+control 'RVM arvados cli gem' do
+  title 'should be installed'
+
+  only_if('Forced requirement for Centos-7 and Ubuntu-18.04') do
+    (os.redhat? and platform[:release].to_f.truncate == 7) or
+      (os.name == 'ubuntu' and platform[:release].to_f.truncate == 18)
+  end
+
+  describe gem('arvados-cli', '/usr/local/rvm/bin/rvm all do gem') do
+    it { should be_installed }
+  end
+end