Skip to content

[WIP] Convert integration test over to Litmus and ServerSpec #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ fixtures:
apt: "puppetlabs/apt"
epel: "stahnma/epel"
concat: "puppetlabs/concat"
wget: "puppet/wget"
sudo: "saz/sudo"
python: "puppet/python"
gcc: "puppetlabs/gcc"
inifile: "puppetlabs/inifile"
mongodb: "puppet/mongodb"
postgresql: "puppetlabs/postgresql"
rabbitmq: "puppet/rabbitmq"
packagecloud: "computology/packagecloud"
selinux: "puppet/selinux"
nginx: "puppet/nginx"
nodejs: "puppet/nodejs"
recursive_file_permissions: "npwalker/recursive_file_permissions"
repositories:
# needed for Litmus
# https://github.com/puppetlabs/puppet_litmus/wiki/Converting-a-module-to-use-Litmus
facts: 'https://github.com/puppetlabs/puppetlabs-facts.git'
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
provision: 'https://github.com/nmaludy/provision.git'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
.coverage
.librarian
.kitchen
.r10k
.tmp
.bundle
/cover/
Expand Down
9 changes: 9 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- .coverage
- .librarian
- .kitchen
- .r10k
- .tmp
- .bundle
- /cover/
Expand All @@ -25,6 +26,11 @@ appveyor.yml:
Gemfile:
required:
':development':
# needed for ed25519 support
- gem: 'bcrypt_pbkdf'
version: '>= 1.0.0'
- gem: 'ed25519'
version: '>= 1.2.0'
- gem: 'puppet-lint-absolute_classname-check'
# pin to 2.0.0 to comply with new standard which removes the leading ::
version: '>= 2.0.0'
Expand All @@ -50,5 +56,8 @@ Gemfile:
version: '>= 0.3.0'
- gem: 'puppet-lint-version_comparison-check'
version: '>= 0.2.1'
- gem: 'puppet_litmus'
git: 'https://github.com/puppetlabs/puppet_litmus.git'
- gem: 'serverspec'
spec/spec_helper.rb:
mock_with: ':rspec'
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ group :development do
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "bcrypt_pbkdf", '>= 1.0.0', require: false
gem "ed25519", '>= 1.2.0', require: false
gem "puppet-lint-absolute_classname-check", '>= 2.0.0', require: false
gem "puppet-lint-absolute_template_path", '>= 1.0.1', require: false
gem "puppet-lint-alias-check", '>= 0.1.1', require: false
Expand All @@ -40,6 +42,8 @@ group :development do
gem "puppet-lint-trailing_comma-check", '>= 0.3.2', require: false
gem "puppet-lint-unquoted_string-check", '>= 0.3.0', require: false
gem "puppet-lint-version_comparison-check", '>= 0.2.1', require: false
gem "puppet_litmus", require: false, git: 'https://github.com/puppetlabs/puppet_litmus.git'
gem "serverspec", require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
2 changes: 0 additions & 2 deletions build/centos6-puppet5/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
2 changes: 0 additions & 2 deletions build/centos6-puppet6/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
2 changes: 0 additions & 2 deletions build/centos7-puppet5/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
2 changes: 0 additions & 2 deletions build/centos7-puppet6/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
15 changes: 15 additions & 0 deletions build/scripts/ci_litmus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e
set -o xtrace

TEST_NAME=docker_centos7
PUPPET_COLLECTION=puppet6
bundle exec rake "litmus:provision_list[$TEST_NAME]"
# provisioner: docker
# bundle exec bolt command run 'yum -y install wget' --inventoryfile inventory.yaml --targets='localhost*'

# provisioner: docker_exp
bundle exec bolt command run 'yum -y install wget' --inventoryfile inventory.yaml --targets='docker_nodes'
bundle exec rake "litmus:install_agent[$PUPPET_COLLECTION]"
bundle exec rake "litmus:install_module"
bundle exec rake "litmus:acceptance:parallel"
6 changes: 6 additions & 0 deletions build/scripts/ci_litmus_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
set -o xtrace

# Tear down all targets in inventory.yml
bundle exec rake "litmus:tear_down"
2 changes: 1 addition & 1 deletion build/scripts/install_puppet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sudo /opt/puppetlabs/puppet/bin/gem install librarian-puppet
sudo yum -y install git

# Install puppet module dependencies
sudo -i bash -c "pushd /vagrant/build/centos7-puppet6 && /opt/puppetlabs/puppet/bin/librarian-puppet install --verbose --path=/etc/puppetlabs/code/modules"
sudo -i bash -c "pushd /vagrant/build/ubuntu18-puppet6 && /opt/puppetlabs/puppet/bin/librarian-puppet install --verbose --path=/etc/puppetlabs/code/modules"

# Create symlink for the st2/ puppet module in the Pupept code directory.
# This allows us to make changes locally, outside of the VM then automatically available
Expand Down
2 changes: 0 additions & 2 deletions build/ubuntu14-puppet5/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
2 changes: 0 additions & 2 deletions build/ubuntu14-puppet6/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
2 changes: 0 additions & 2 deletions build/ubuntu16-puppet5/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
2 changes: 0 additions & 2 deletions build/ubuntu16-puppet6/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
# │ ├── puppet-archive (v3.2.1)
# │ └── camptocamp-systemd (v2.3.0)
# ├── ghoneycutt-facter (v3.5.0)
# ├── computology-packagecloud (v0.3.2)
# ├── puppet-selinux (v1.6.1)
# ├── puppet-nginx (v0.16.0)
# └── puppet-nodejs (v7.0.0)
Expand All @@ -58,7 +57,6 @@ mod 'puppet-rabbitmq'
mod 'puppet-archive' # dependency of puppet-rabbitmq
mod 'camptocamp-systemd' # dependency of puppet-rabbitmq
mod 'ghoneycutt-facter'
mod 'computology-packagecloud'
mod 'puppet-selinux'
mod 'puppet-nginx'
mod 'puppet-nodejs'
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
# Set the number of actionrunner processes to start
# @param packs
# Hash of st2 packages to be installed
# @param packs_group
# Name of the group that will own the /opt/stackstorm/packs directory (default: st2packs)
# @param index_url
# Url to the StackStorm Exchange index file. (default undef)
# @param mistral_db_host
Expand Down Expand Up @@ -245,6 +247,7 @@
$cli_auth_url = "http://${::st2::params::hostname}:${::st2::params::auth_port}",
$actionrunner_workers = $::st2::params::actionrunner_workers,
$packs = {},
$packs_group = $::st2::params::packs_group_name,
$index_url = undef,
$mistral_db_host = $::st2::params::hostname,
$mistral_db_name = $::st2::params::mistral_db_name,
Expand Down
41 changes: 0 additions & 41 deletions manifests/pack.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,6 @@
include st2
$_cli_username = $::st2::cli_username
$_cli_password = $::st2::cli_password
$_st2_packs_group = $::st2::params::packs_group_name

ensure_resource('group', $_st2_packs_group, {
'ensure' => present,
})

ensure_resource('file', '/opt/stackstorm', {
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0755',
})

ensure_resource('file', '/opt/stackstorm/packs', {
'ensure' => 'directory',
'owner' => 'root',
'group' => $_st2_packs_group,
'recurse' => true,
'tag' => 'st2::subdirs',
})

ensure_resource('file', '/opt/stackstorm/configs', {
'ensure' => 'directory',
'owner' => 'st2',
'group' => 'root',
'mode' => '0755',
'tag' => 'st2::subdirs',
})

ensure_resource('file', '/opt/stackstorm/virtualenvs', {
'ensure' => 'directory',
'owner' => 'root',
'group' => $_st2_packs_group,
'mode' => '0755',
'tag' => 'st2::subdirs',
})


st2_pack { $pack:
ensure => $ensure,
Expand All @@ -86,10 +49,6 @@
~> Exec<| tag == 'st2::register-configs' |>
}

Group[$_st2_packs_group]
-> File['/opt/stackstorm']
-> File<| tag == 'st2::subdirs' |>

Service<| tag == 'st2::service' |> -> St2_pack<||>
Exec<| tag == 'st2::reload' |> -> St2_pack<||>
}
25 changes: 5 additions & 20 deletions manifests/profile/repos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,17 @@
#
# @param repository
# Release repository to enable. Options: 'stable', 'unstable'.
# @param package_type
# Type of package management system used for repo. Options: 'rpm', 'deb'
#
class st2::profile::repos(
$repository = $::st2::repository,
$package_type = $::st2::params::package_type,
Enum['stable', 'unstable'] $repository = $st2::repository,
) inherits st2 {
require packagecloud

if $::osfamily == 'RedHat' {
require epel
}
$_packagecloud_repo = "StackStorm/${repository}"
packagecloud::repo { $_packagecloud_repo:
type => $package_type,
}

# On ubuntu 14, the packagecloud repo addition corrupts the apt-cache...
# this cleans it out and refreshes it
if ($::osfamily == 'Debian' and
versioncmp($::operatingsystemmajrelease, '14.04') == 0) {
exec { 'Refresh apt-cache after packagecloud':
command => 'rm -rf /var/lib/apt/lists/*; apt-get update',
path => ['/usr/bin/', '/bin/'],
refreshonly => true,
subscribe => Packagecloud::Repo[$_packagecloud_repo],
}
# defines the StackStorm repo (Yum and Apt are handled here)
class { 'st2::repo':
repository => $repository,
}
contain st2::repo
}
Loading