Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mirror
rsyslog
Commits
4f9e113e
Commit
4f9e113e
authored
Oct 24, 2020
by
Lance Albertson
Browse files
Migrate to InSpec for integration tests
Signed-off-by:
Lance Albertson
<
lance@osuosl.org
>
parent
ebd86e22
Changes
19
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
4f9e113e
...
...
@@ -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
...
...
kitchen.yml
View file @
4f9e113e
...
...
@@ -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
test/fixtures/rsyslog_test/recipes/client.rb
View file @
4f9e113e
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/integration/client/bats/verify_client.bats
deleted
100644 → 0
View file @
ebd86e22
@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
}
test/integration/client/controls/client_spec.rb
0 → 100644
View file @
4f9e113e
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
test/integration/client/inspec.yml
0 → 100644
View file @
4f9e113e
---
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/integration/default/bats/verify_installed.bats
deleted
100644 → 0
View file @
ebd86e22
@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
}
test/integration/default/controls/default_spec.rb
0 → 100644
View file @
4f9e113e
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
test/integration/default/inspec.yml
0 → 100644
View file @
4f9e113e
---
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
test/integration/helpers/serverspec/spec_helper.rb
deleted
100644 → 0
View file @
ebd86e22
require
'serverspec'
set
:backend
,
:exec
test/integration/input_file_resource/controls/input_file_provider_spec.rb
0 → 100644
View file @
4f9e113e
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
test/integration/input_file_resource/inspec.yml
0 → 100644
View file @
4f9e113e
---
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
test/integration/input_file_resource/serverspec/input_file_provider_spec.rb
deleted
100644 → 0
View file @
ebd86e22
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
test/integration/relp/controls/relp_spec.rb
0 → 100644
View file @
4f9e113e
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
test/integration/relp/inspec.yml
0 → 100644
View file @
4f9e113e
---
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
test/integration/relp/serverspec/relp_spec.rb
deleted
100644 → 0
View file @
ebd86e22
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
test/integration/server/controls/server_spec.rb
0 → 100644
View file @
4f9e113e
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
test/integration/server/inspec.yml
0 → 100644
View file @
4f9e113e
---
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
test/integration/server/serverspec/server_spec.rb
deleted
100644 → 0
View file @
ebd86e22
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment