fix(config): ensure AnonymousUserToken is set
[arvados-formula.git] / test / integration / shell / controls / config_spec.rb
index 9fa65b7af63d9084985647f0841d13451c4e690e..f0e8a7ef14b3765f71680af5fc59bc0d8dd2f8f4 100644 (file)
@@ -1,28 +1,44 @@
 # frozen_string_literal: true
 
-siab_stanza = <<~SIAB_STANZA
-  SHELLINABOX_PORT=4200
-  # SSL is disabled because it is terminated in Nginx. Adjust as needed.
-  SHELLINABOX_ARGS="--disable-ssl --no-beep --service=/shell.fixme.example.net:AUTH:HOME:SHELL"
-SIAB_STANZA
+control 'arvados configuration file' do
+  title 'should not exist'
 
-libpam_stanza = <<~LIBPAM_STANZA
-  auth [success=1 default=ignore] /usr/lib/pam_arvados.so fixme.example.net shell.fixme.example.net
-LIBPAM_STANZA
+  describe file('/etc/arvados/config.yml') do
+    it { should_not exist}
+  end
+end
 
 control 'shellinabox configuration' do
   title 'should match desired lines'
 
-  describe file('/etc/default/shellinabox') do
+  case os[:name]
+  when 'centos'
+    file = '/etc/sysconfig/shellinaboxd'
+    tpl = 'RedHat'
+    siab_stanza = <<~SIAB_STANZA
+      PORT=4200
+      # SSL is disabled because it is terminated in Nginx. Adjust as needed.
+      OPTS="--disable-ssl --no-beep --service=/shell.fixme.example.net:SSH"
+    SIAB_STANZA
+  when 'debian', 'ubuntu'
+    file = '/etc/default/shellinabox'
+    tpl = 'default'
+    siab_stanza = <<~SIAB_STANZA
+      SHELLINABOX_PORT=4200
+      # SSL is disabled because it is terminated in Nginx. Adjust as needed.
+      SHELLINABOX_ARGS="--disable-ssl --no-beep --service=/shell.fixme.example.net:AUTH:HOME:SHELL"
+    SIAB_STANZA
+  end
+  describe file(file) do
     it { should be_file }
     it { should be_owned_by 'root' }
     it { should be_grouped_into 'root' }
     its('mode') { should cmp '0644' }
     its('content') do
       should include(
-        # rubocop:disable Metrics/LineLength
-        'File managed by Salt at <salt://arvados/shell/config/files/default/shell-shellinabox.tmpl.jinja>.'
-        # rubocop:enable Metrics/LineLength
+        # rubocop:disable Layout/LineLength
+        "File managed by Salt at <salt://arvados/shell/config/files/#{tpl}/shell-shellinabox.tmpl.jinja>."
+        # rubocop:enable Layout/LineLength
       )
     end
     its('content') { should include(siab_stanza) }
@@ -32,6 +48,10 @@ end
 control 'libpam-arvados configuration' do
   title 'should match desired lines'
 
+  libpam_stanza = <<~LIBPAM_STANZA
+    auth [success=1 default=ignore] /usr/lib/pam_arvados.so fixme.example.net shell.fixme.example.net
+  LIBPAM_STANZA
+
   describe file('/etc/pam.d/arvados') do
     it { should be_file }
     it { should be_owned_by 'root' }
@@ -39,9 +59,9 @@ control 'libpam-arvados configuration' do
     its('mode') { should cmp '0644' }
     its('content') do
       should include(
-        # rubocop:disable Metrics/LineLength
+        # rubocop:disable Layout/LineLength
         'File managed by Salt at <salt://arvados/shell/config/files/default/shell-libpam-arvados.tmpl.jinja>.'
-        # rubocop:enable Metrics/LineLength
+        # rubocop:enable Layout/LineLength
       )
     end
     its('content') { should include(libpam_stanza) }