Skip to content
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
pkg/
.bundle/
Gemfile.lock
log/
vendor/
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
language: ruby
bundler_args: --without development
before_install: rm Gemfile.lock || true
services:
- docker
matrix:
fast_finish: true
include:
- rvm: 2.1
env: PUPPET_INSTALL_TYPE=agent BEAKER_set=docker/centos-6-x64
script: bundle exec rake beaker
services: docker
sudo: required
- rvm: 2.1
env: PUPPET_INSTALL_TYPE=agent BEAKER_set=docker/centos-7-x64
script: bundle exec rake beaker
services: docker
sudo: required
notifications:
email: false
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'

group :system_tests do
gem "beaker"
gem "beaker-rspec"
gem "beaker-puppet_install_helper"
gem "serverspec-extended-types"
end
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/sumpfgottheit/puppet-pythonel.svg?branch=master)](https://travis-ci.org/sumpfgottheit/puppet-pythonel)

# Supported Platforms

- **Enterprise Linux 6**: RHEL6, CentOS6 and clones (not tested)
Expand Down
82 changes: 82 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
require 'spec_helper_acceptance'

describe 'pythonel' do
describe 'python35_ius' do
# Using puppet_apply as a helper
it 'should work idempotently with no errors' do
pp = <<-EOS
package {['centos-release-scl', 'epel-release']:
ensure => 'present'
}
package {'ius-release':
ensure => 'present',
provider => 'rpm',
source => "https://centos${::operatingsystemmajrelease}.iuscommunity.org/ius-release.rpm",
}
include pythonel::interpreter::python35_ius
pythonel::virtualenv { '/tmp/myapp_python35_ius':
interpreter => 'python35_ius',
systempkgs => true,
} ->
pythonel::pip { 'myapp-colorama':
package => 'colorama',
virtualenv => '/tmp/myapp_python35_ius',
interpreter => 'python35_ius'
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe package('python35u') do
it { is_expected.to be_installed }
end
describe virtualenv('/tmp/myapp_python35_ius') do
it { should be_virtualenv }
its(:pip_freeze) { should include('colorama') }
its(:python_version) { should match /^3\.5/ }
end
end

describe 'rh_python34_scl' do
# Using puppet_apply as a helper
it 'should work idempotently with no errors' do
pp = <<-EOS
package {'centos-release-scl':
ensure => 'present'
}
include pythonel::interpreter::rh_python34_scl
pythonel::virtualenv { '/tmp/myapp_rh_python34_scl':
interpreter => 'rh_python34_scl',
systempkgs => true,
} ->
pythonel::pip { 'myapp-colorama':
package => 'colorama',
virtualenv => '/tmp/myapp_rh_python34_scl',
interpreter => 'rh_python34_scl'
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end

# we can't use virtualenv serverspec here because you need to run 'scl
# enable rh-python34' before running any of the commands. the best we can do
# is check the directory for things that should be there
describe file('/tmp/myapp_rh_python34_scl') do
it { should be_directory }
end

describe file('/tmp/myapp_rh_python34_scl/bin/python3') do
it { should exist }
it { should be_executable }
end

describe file('/tmp/myapp_rh_python34_scl/lib/python3.4/site-packages/colorama') do
it { should be_directory }
end
end
end
12 changes: 12 additions & 0 deletions spec/acceptance/nodesets/docker/centos-6-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
HOSTS:
centos-6-x64:
platform: centos-6-x86_64
hypervisor: docker
image: centos:6
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'rm -rf /var/run/network/*'
- 'yum install -y crontabs tar wget which'
CONFIG:
type: foss
masterless: true
13 changes: 13 additions & 0 deletions spec/acceptance/nodesets/docker/centos-7-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
HOSTS:
centos-7-x64:
platform: centos-7-x86_64
hypervisor: docker
image: centos:7
docker_preserve_image: true
docker_cmd: '["/usr/sbin/init"]'
# install various tools required to get the image up to usable levels
docker_image_commands:
- 'yum install -y crontabs tar wget openssl sysvinit-tools iproute which initscripts'
CONFIG:
type: foss
masterless: true
20 changes: 20 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
require 'serverspec_extended_types'

run_puppet_install_helper

RSpec.configure do |c|
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do
# Install module
puppet_module_install(:source => module_root, :module_name => 'pythonel')
hosts.each do |host|
on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
end
end
end