-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(kitchen+travis): update testing environment
* Use latest pre-salted images * Move from serverspec to inspec * Fix failing tests
- Loading branch information
1 parent
29c8a43
commit 3fa2a58
Showing
12 changed files
with
244 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
stages: | ||
- test | ||
- commitlint | ||
- name: release | ||
if: branch = master AND type != pull_request | ||
|
||
sudo: required | ||
cache: bundler | ||
language: ruby | ||
|
||
services: | ||
- docker | ||
|
||
# Make sure the instances listed below match up with | ||
# the `platforms` defined in `kitchen.yml` | ||
# NOTE: Please try to select up to six instances that add some meaningful | ||
# testing of the formula's behaviour. If possible, try to refrain from | ||
# the classical "chosing all the instances because I want to test on | ||
# another/all distro/s" trap: it will just add time to the testing (see | ||
# the discussion on #121). As an example, the set chosen below covers | ||
# the most used distros families, systemd and non-systemd and the latest | ||
# three supported Saltstack versions with python2 and 3." | ||
# As for `kitchen.yml`, that should still contain all of the platforms, | ||
# to allow for comprehensive local testing | ||
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118 | ||
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121 | ||
env: | ||
matrix: | ||
- INSTANCE: repositories-debian-9-2019-2-py3 | ||
- INSTANCE: repositories-ubuntu-1804-2019-2-py3 | ||
- INSTANCE: preferences-debian-9-2019-2-py3 | ||
- INSTANCE: preferences-ubuntu-1804-2019-2-py3 | ||
|
||
script: | ||
- bundle exec kitchen verify ${INSTANCE} | ||
|
||
jobs: | ||
include: | ||
# Define the commitlint stage | ||
- stage: commitlint | ||
language: node_js | ||
node_js: lts/* | ||
before_install: skip | ||
script: | ||
- npm install @commitlint/config-conventional -D | ||
- npm install @commitlint/travis-cli -D | ||
- commitlint-travis | ||
# Define the release stage that runs semantic-release | ||
- stage: release | ||
language: node_js | ||
node_js: lts/* | ||
before_install: skip | ||
script: | ||
# Update `AUTHORS.md` | ||
- export MAINTAINER_TOKEN=${GH_TOKEN} | ||
- go get github.com/myii/maintainer | ||
- maintainer contributor | ||
|
||
# Install all dependencies required for `semantic-release` | ||
- npm install @semantic-release/changelog@3 -D | ||
- npm install @semantic-release/exec@3 -D | ||
- npm install @semantic-release/git@7 -D | ||
deploy: | ||
provider: script | ||
skip_cleanup: true | ||
script: | ||
# Run `semantic-release` | ||
- npx semantic-release@15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'kitchen-docker', '>= 2.9' | ||
gem 'kitchen-salt', '>= 0.6.0' | ||
gem 'kitchen-inspec', '>= 1.1' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
# For help on this file's format, see https://kitchen.ci/ | ||
driver: | ||
name: docker | ||
use_sudo: false | ||
privileged: true | ||
run_command: /lib/systemd/systemd | ||
|
||
# Make sure the platforms listed below match up with | ||
# the `env.matrix` instances defined in `.travis.yml` | ||
platforms: | ||
- name: debian-9-2019-2-py3 | ||
driver: | ||
image: netmanagers/salt-2019.2-py3:debian-9 | ||
- name: ubuntu-1804-2019-2-py3 | ||
driver: | ||
image: netmanagers/salt-2019.2-py3:ubuntu-18.04 | ||
|
||
provisioner: | ||
name: salt_solo | ||
log_level: info | ||
salt_install: none | ||
require_chef: false | ||
formula: apt | ||
salt_copy_filter: | ||
- .kitchen | ||
- .git | ||
pillars: | ||
top.sls: | ||
base: | ||
'*': | ||
- apt | ||
|
||
verifier: | ||
# https://www.inspec.io/ | ||
name: inspec | ||
sudo: true | ||
# cli, documentation, html, progress, json, json-min, json-rspec, junit | ||
reporter: | ||
- cli | ||
|
||
suites: | ||
- name: repositories | ||
provisioner: | ||
state_top: | ||
base: | ||
'*': | ||
- apt.repositories | ||
- apt.update | ||
pillars_from_files: | ||
apt.sls: test/salt/pillar/repositories.pillar.sls | ||
verifier: | ||
inspec_tests: | ||
- path: test/integration/repositories | ||
- name: preferences | ||
provisioner: | ||
state_top: | ||
base: | ||
'*': | ||
- apt.preferences | ||
pillars_from_files: | ||
apt.sls: test/salt/pillar/preferences.pillar.sls | ||
verifier: | ||
inspec_tests: | ||
- path: test/integration/preferences |
19 changes: 9 additions & 10 deletions
19
...references/serverspec/preferences_spec.rb → .../preferences/controls/preferences_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,47 @@ | ||
require_relative '../../../kitchen/data/spec_helper' | ||
|
||
describe 'apt.preferences' do | ||
control 'Apt preferences' do | ||
title 'should be configured' | ||
|
||
describe file('/etc/apt/preferences') do | ||
it { should_not exist } | ||
it { should exist } | ||
its(:size) { should eq 0 } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d') do | ||
it { should be_directory } | ||
it { should be_mode 755 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0755' } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/00-rspamd') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its(:content) { should match("Package: rspamd\nPin: origin rspamd.com\nPin-Priority: 650\n") } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/01-all') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its(:content) { should match("Package: *\nPin: release stable\nPin-Priority: 610\n") } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/02-all') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its(:content) { should match("Package: *\nPin: release testing\nPin-Priority: 600\n") } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/03-all') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its(:content) { should match("Package: *\nPin: release unstable\nPin-Priority: 50\n") } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: preferences | ||
title: Apt Formula | ||
maintainer: Saltstack-formulas org | ||
license: Apache-2.0 | ||
summary: Verify that the apt preferences are configured correctly | ||
supports: | ||
- os-name: debian | ||
- os-name: ubuntu |
41 changes: 41 additions & 0 deletions
41
test/integration/repositories/controls/repositories_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
control 'Apt repositories' do | ||
title 'should be configured' | ||
|
||
if os[:name] == 'ubuntu' | ||
keyring_package = 'ubuntu-keyring' | ||
else | ||
keyring_package = 'debian-archive-keyring' | ||
end | ||
|
||
describe package(keyring_package) do | ||
it { should be_installed } | ||
end | ||
|
||
describe file('/etc/apt/sources.list') do | ||
it { should exist } | ||
its(:size) { should eq 0 } | ||
end | ||
|
||
describe file('/etc/apt/sources.list.d') do | ||
it { should be_directory } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0755' } | ||
end | ||
|
||
describe file('/etc/apt/sources.list.d/spotify-binary.list') do | ||
it { should exist } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its(:content) { should match(%r{deb \[arch=amd64\] http://repository.spotify.com stable non-free}) } | ||
end | ||
|
||
describe file('/etc/apt/sources.list.d/heroku-binary.list') do | ||
it { should exist } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its(:content) { should match(%r{deb \[arch=amd64\] https://cli-assets.heroku.com/apt ./}) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: repositories | ||
title: Apt Formula | ||
maintainer: Saltstack-formulas org | ||
license: Apache-2.0 | ||
summary: Verify that the apt repositories are configured correctly | ||
supports: | ||
- os-name: debian | ||
- os-name: ubuntu |
36 changes: 0 additions & 36 deletions
36
test/integration/repositories/serverspec/repositories_spec.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apt: | ||
remove_preferences: true | ||
clean_preferences_d: true | ||
|
||
preferences: | ||
00-rspamd: | ||
package: rspamd | ||
pin: origin rspamd.com | ||
priority: 650 | ||
01-all: | ||
pin: release stable | ||
priority: 610 | ||
02-all: | ||
pin: release testing | ||
priority: 600 | ||
03-all: | ||
pin: release unstable | ||
priority: 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apt: | ||
remove_sources_list: true | ||
clean_sources_list_d: true | ||
|
||
repositories: | ||
spotify: | ||
distro: stable | ||
url: http://repository.spotify.com | ||
arch: [amd64] | ||
comps: [non-free] | ||
keyid: 931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90 | ||
keyserver: keyserver.ubuntu.com | ||
heroku: | ||
distro: ./ | ||
url: https://cli-assets.heroku.com/apt | ||
arch: [amd64] | ||
comps: [] | ||
key_url: https://cli-assets.heroku.com/apt/release.key | ||
|
This file was deleted.
Oops, something went wrong.