GitLab upgraded to 13.9.1-ee.0 - changelog: https://gitlab.com/gitlab-org/gitlab/blob/master/CHANGELOG-EE.md

Commit 4f9e113e authored by Lance Albertson's avatar Lance Albertson

Migrate to InSpec for integration tests

Signed-off-by: default avatarLance Albertson <lance@osuosl.org>
parent ebd86e22
......@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update README to sous-chefs
- Update metadata.rb to Sous Chefs
- Update test-kitchen to Sous Chefs
- Migrate to InSpec for integration tests
### Fixed
......
......@@ -29,6 +29,10 @@ suites:
- name: relp
run_list:
- recipe[rsyslog::client]
verifier:
inspec_tests:
- name: rsyslog-default-integration-tests
path: test/integration/default
attributes:
rsyslog:
use_relp: true
......@@ -45,6 +49,10 @@ suites:
- name: client
run_list:
- recipe[rsyslog_test::client]
verifier:
inspec_tests:
- name: rsyslog-default-integration-tests
path: test/integration/default
attributes:
rsyslog:
server_ip: 10.0.0.50
......@@ -61,6 +69,14 @@ suites:
- name: server
run_list:
- recipe[rsyslog_test::server]
verifier:
inspec_tests:
- name: rsyslog-default-integration-tests
path: test/integration/default
- name: input_file_resource
run_list:
- recipe[rsyslog_test::input_file_resource]
verifier:
inspec_tests:
- name: rsyslog-default-integration-tests
path: test/integration/default
apt_update
require 'fileutils'
unless Dir.exist?("#{node['rsyslog']['config_prefix']}/rsyslog.d")
FileUtils.mkdir("#{node['rsyslog']['config_prefix']}/rsyslog.d")
end
FileUtils.touch("#{node['rsyslog']['config_prefix']}/rsyslog.d/server.conf")
include_recipe 'rsyslog::client'
@test "the config sets ActiveQueueMaxDiskSpace to 1G" {
grep "^\$ActionQueueMaxDiskSpace 1G" /etc/rsyslog.d/49-remote.conf
}
@test "the config points to the remote server" {
grep "@@10.0.0.50:514" /etc/rsyslog.d/49-remote.conf
}
@test "Custom config is generated" {
egrep 'auth\.\*,mail\.\* @10.0.0.45:555' /etc/rsyslog.d/49-remote.conf && egrep 'authpriv\.\*,cron\.\*,daemon\.\* @@10.1.1.33:654' /etc/rsyslog.d/49-remote.conf
}
control 'client' do
describe file '/etc/rsyslog.d/49-remote.conf' do
its('content') { should match /^\$ActionQueueMaxDiskSpace 1G/ }
its('content') { should match /@@10.0.0.50:514/ }
its('content') { should match /auth\.\*,mail\.\* @10.0.0.45:555/ }
its('content') { should match /authpriv\.\*,cron\.\*,daemon\.\* @@10.1.1.33:654/ }
end
end
---
name: rsyslog-client-integration-tests
title: Integration tests for the rsyslog cookbook
summary: This InSpec profile contains integration tests for rsyslog cookbook
supports:
- os-family: linux
@test "rsyslog is up and running" {
pgrep rsyslogd
}
# Ignore comments
# Ignore lines starting with $
# Ignore blank lines
# ensure facility is in proper format - x.x
@test "ensure default.conf is valid" {
awk '$1 !~ /(^(#|\$|:)|^$|(.+\..+)+)/ { exit 1 }' /etc/rsyslog.d/50-default.conf
}
control 'service' do
describe service 'rsyslog' do
it { should be_running }
it { should be_enabled }
end
end
control 'default-conf' do
describe file '/etc/rsyslog.d/50-default.conf' do
its('content') { should match /(^(#|\$|:)|^$|(.+\..+)+)/ }
end
end
---
name: rsyslog-default-integration-tests
title: Integration tests for the rsyslog cookbook
summary: This InSpec profile contains integration tests for rsyslog cookbook
supports:
- os-family: linux
require 'serverspec'
set :backend, :exec
control 'input-file-resource' do
describe file '/etc/rsyslog.d/99-test-file.conf' do
it { should exist }
its('content') { should match %r{InputFileName /var/log/boot} }
its('content') { should match /InputFileTag test-file/ }
its('content') { should match /InputFileStateFile test-file/ }
end
end
---
name: rsyslog-input-file-integration-tests
title: Integration tests for the rsyslog cookbook
summary: This InSpec profile contains integration tests for rsyslog cookbook
supports:
- os-family: linux
require_relative './spec_helper'
describe service('rsyslog') do
it { should be_running }
end
describe file('/etc/rsyslog.d/99-test-file.conf') do
it { should exist }
end
describe file('/etc/rsyslog.d/99-test-file.conf') do
its(:content) { should match %r{InputFileName /var/log/boot} }
end
describe file('/etc/rsyslog.d/99-test-file.conf') do
its(:content) { should match /InputFileTag test-file/ }
end
describe file('/etc/rsyslog.d/99-test-file.conf') do
its(:content) { should match /InputFileStateFile test-file/ }
end
control 'relp' do
describe package 'rsyslog-relp' do
it { should be_installed }
end
describe file '/etc/rsyslog.d/49-remote.conf' do
its('content') { should match /'*.* :omrelp:10.0.0.45:20514\n'*.* :omrelp:10.1.1.33:20514;RSYSLOG_SyslogProtocol23Format/ }
end
end
---
name: rsyslog-relp-integration-tests
title: Integration tests for the rsyslog cookbook
summary: This InSpec profile contains integration tests for rsyslog cookbook
supports:
- os-family: linux
require_relative './spec_helper'
describe service('rsyslog') do
it { should be_running }
end
describe package('rsyslog-relp') do
it { should be_installed }
end
describe file('/etc/rsyslog.d/49-remote.conf') do
its(:content) { should match /'*.* :omrelp:10.0.0.45:20514\n'*.* :omrelp:10.1.1.33:20514;RSYSLOG_SyslogProtocol23Format/ }
end
control 'server' do
describe file '/etc/rsyslog.d/35-server-per-host.conf' do
it { should be_file }
end
describe file '/etc/rsyslog.d/49-remote.conf' do
it { should_not be_file }
end
end
---
name: rsyslog-server-integration-tests
title: Integration tests for the rsyslog cookbook
summary: This InSpec profile contains integration tests for rsyslog cookbook
supports:
- os-family: linux
require_relative './spec_helper'
describe service('rsyslog') do
it { should be_running }
end
describe file('/etc/rsyslog.d/35-server-per-host.conf') do
it { should be_file }
end
describe file('/etc/rsyslog.d/49-remote.conf') do
it { should_not be_file }
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment