Permalink
Browse files

initial commit rspec files

  • Loading branch information...
arioch committed Jan 29, 2012
1 parent 8aa403d commit 66e67caeb7beeb414adbfff8e01c1a6e14d1a116
View
@@ -0,0 +1,9 @@
+require 'rake'
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:rspec) do |t|
+ t.pattern = 'spec/*/*_spec.rb'
+ t.rspec_opts = "--format documentation --color"
+end
+
+task :default => :rspec
View
@@ -11,21 +11,21 @@
package {
$percona::params::pkg_common:
- ensure => installed;
+ ensure => present;
}
if $percona::client {
package {
$percona::params::pkg_client:
- ensure => installed,
+ ensure => present,
require => Package[$percona::params::pkg_common];
}
}
if $percona::server {
package {
$percona::params::pkg_server:
- ensure => installed,
+ ensure => present,
require => Package[$percona::params::pkg_client];
}
}
View
@@ -30,7 +30,7 @@
'RedHat', 'redhat', 'CentOS', 'centos': {
package { 'percona-release':
- ensure => installed,
+ ensure => present,
provider => 'rpm',
source => "http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.${::hardwaremodel}.rpm";
}
View
@@ -0,0 +1,3 @@
+node percona {
+ include percona
+}
@@ -0,0 +1,144 @@
+require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
+
+describe 'percona' do
+ describe "[Debian] percona class w/o parameters" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::params') }
+ it { should include_class('percona::preinstall') }
+ it { should include_class('percona::install') }
+ it { should include_class('percona::config') }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::service') }
+ end
+
+ describe "[CentOS] percona class w/o parameters" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::params') }
+ it { should include_class('percona::preinstall') }
+ it { should include_class('percona::install') }
+ it { should include_class('percona::config') }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::service') }
+ end
+
+ describe "[Debian] percona class with parameters, server true, no version specified" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'true' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::config::server') }
+
+ it { should contain_package('percona-toolkit').with_ensure('present') }
+ it { should contain_package('percona-server-client-5.5').with_ensure('present') }
+ it { should contain_package('percona-server-server-5.5').with_ensure('present') }
+
+ end
+
+ describe "[CentOS] percona class with parameters, server true, no version specified" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'true' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::config::server') }
+
+ it { should contain_package('percona-toolkit').with_ensure('present') }
+ it { should contain_package('Percona-Server-client-55').with_ensure('present') }
+ it { should contain_package('Percona-Server-server-55').with_ensure('present') }
+ end
+
+ describe "[Debian] percona class with parameters, server true, version 5.1" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'true', :percona_version => '5.1' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::config::server') }
+
+ it { should contain_package('percona-toolkit').with_ensure('present') }
+ it { should contain_package('percona-server-client-5.1').with_ensure('present') }
+ it { should contain_package('percona-server-server-5.1').with_ensure('present') }
+
+ end
+
+ describe "[CentOS] percona class with parameters, server true, version 5.1" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'true', :percona_version => '5.1' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::config::server') }
+
+ it { should contain_package('percona-toolkit').with_ensure('present') }
+ it { should contain_package('Percona-Server-client-51').with_ensure('present') }
+ it { should contain_package('Percona-Server-server-51').with_ensure('present') }
+ end
+
+ describe "[Debian] percona class with parameters, server true, version 5.5" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'true', :percona_version => '5.5' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::config::server') }
+
+ it { should contain_package('percona-toolkit').with_ensure('present') }
+ it { should contain_package('percona-server-client-5.5').with_ensure('present') }
+ it { should contain_package('percona-server-server-5.5').with_ensure('present') }
+
+ end
+
+ describe "[CentOS] percona class with parameters, server true, version 5.5" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'true', :percona_version => '5.5' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ it { should include_class('percona::config::server') }
+
+ it { should contain_package('percona-toolkit').with_ensure('present') }
+ it { should contain_package('Percona-Server-client-55').with_ensure('present') }
+ it { should contain_package('Percona-Server-server-55').with_ensure('present') }
+ end
+
+ describe "[Debian] percona class with parameters, server false" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'false' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ end
+
+ describe "[CentOS] percona class with parameters, server false" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+ let(:params) { {:client => 'true', :server => 'false' } }
+
+ it { should create_class("percona") }
+ it { should include_class('percona::config::client') }
+ end
+end
@@ -0,0 +1,15 @@
+require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
+
+describe 'percona::install' do
+ describe "[Debian] percona::install class, server" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+ end
+
+ describe "[CentOS] percona::install class, server" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+ end
+end
@@ -0,0 +1,19 @@
+require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
+
+describe 'percona::params' do
+ describe "[Debian] percona::params class" do
+ let(:title) { 'percona::params' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+
+ it { should create_class("percona::params") }
+ end
+
+ describe "[CentOS] percona::params class" do
+ let(:title) { 'percona::params' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+
+ it { should create_class("percona::params") }
+ end
+end
@@ -0,0 +1,33 @@
+require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
+
+describe 'percona::preinstall' do
+ describe "[Debian] percona::preinstall class" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
+
+ it { should create_class("percona::preinstall") }
+
+ it { should contain_exec('apt-get update')\
+ .with_command("apt-get update")\
+ .with_refreshonly(true)
+ }
+
+ it { should contain_apt__key('CD2EFD2A')\
+ .with_notify(["Exec[apt-get update]"])
+ }
+
+ it { should contain_apt__sources_list('percona')\
+ .with_ensure('present')
+ }
+ end
+
+ describe "[CentOS] percona::preinstall class" do
+ let(:title) { 'percona' }
+ let(:node) { 'percona' }
+ let(:facts) { {:operatingsystem => 'CentOS', :kernel => 'Linux'} }
+
+ it { should create_class("percona::preinstall") }
+ it { should contain_package('percona-release').with_ensure('present') }
+ end
+end
View
@@ -0,0 +1,8 @@
+require 'rspec-puppet'
+require 'spec_helper'
+
+RSpec.configure do |c|
+ #c.module_path = '../../'
+ c.module_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
+ c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), '..','manifests'))
+end
@@ -0,0 +1,21 @@
+#
+# Managed by Puppet.
+#
+
+[mysqld]
+datadir=<%= scope.lookupvar('percona::params::datadir') %>
+socket=<%= scope.lookupvar('percona::params::socket') %>
+user=<%= scope.lookupvar('percona::params::user') %>
+innodb_file_per_table
+
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0
+
+[mysqld_safe]
+log-error=<%= scope.lookupvar('percona::params::errorlog') %>
+pid-file=<%= scope.lookupvar('percona::params::pidfile') %>
+
+
+[xtrabackup]
+datadir=<%= scope.lookupvar('percona::params::datadir') %>
+target_dir=<%= scope.lookupvar('percona::params::targetdir') %>

0 comments on commit 66e67ca

Please sign in to comment.