18761: use repository keyring instead of key_id
[arvados-formula.git] / test / integration / repo / controls / repo_spec.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 # frozen_string_literal: true
6
7 case os[:name]
8 when 'centos'
9   repo_file = '/etc/yum.repos.d/arvados.repo'
10   repo_url = 'baseurl=http://rpm.arvados.org/CentOS/$releasever/os/$basearch/'
11 when 'debian', 'ubuntu'
12   # Inspec does not provide a `codename` matcher, so we add ours
13   case platform[:release].to_f.truncate
14   # ubuntu
15   when 18
16     codename = 'bionic'
17   when 20
18     codename = 'focal'
19   # debian
20   when 10
21     codename = 'buster'
22   when 11
23     codename = 'bullseye'
24   end
25   repo_file = '/etc/apt/sources.list.d/arvados.list'
26   repo_keyring = '/usr/share/keyrings/arvados-archive-keyring.gpg'
27   repo_url = "deb [signed-by=/usr/share/keyrings/arvados-archive-keyring.gpg arch=amd64] http://apt.arvados.org/#{codename} #{codename} main"
28 end
29
30 control 'arvados repository keyring' do
31   title 'should be installed'
32
33   only_if('Requirement for Debian family') do
34     platform.family == 'debian'
35   end
36
37   describe file(repo_keyring) do
38     it { should exist }
39     it { should be_owned_by 'root' }
40     it { should be_grouped_into 'root' }
41     its('mode') { should cmp '0644' }
42   end
43 end
44
45 control 'arvados repository' do
46   impact 1
47   title 'should be configured'
48   desc 'Ensures arvados source is correctly configured'
49   describe file(repo_file) do
50     its('content') { should include repo_url }
51   end
52 end