Skip to content

Commit

Permalink
added extra OS for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
biemond committed May 4, 2015
1 parent b3483c6 commit 7a2a089
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ pkg
/log

*.lock
.vagrant

spec/fixtures/*

spec/reports/*
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ gem 'facter', '>= 1.6.10'
gem 'ci_reporter_rspec'
gem 'rubocop', :git => 'https://github.com/bbatsov/rubocop', :require => false
gem 'puppet-blacksmith'
gem 'beaker'
gem 'beaker-rspec'
gem 'serverspec'
gem 'fog', '>= 1.25.0'
gem 'beaker', '>= 2.0.0'
gem 'beaker-rspec', '>= 5.0.0'
gem 'serverspec', '>= 2.0.0'

35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ or you can override a paramater

**From a source:**

Source supports: http://, ftp://, file://
Source supports: http://, ftp://, file://

wildfly::standalone::deploy { 'hawtio.war':
source => 'http://central.maven.org/maven2/io/hawt/hawtio-web/1.4.48/hawtio-web-1.4.48.war',
checksum => '303e8fcb569a0c3d33b7c918801e5789621f6639' #sha1
}
}

## User management

You can add App and Management users (requires server restart).
Expand Down Expand Up @@ -123,7 +123,7 @@ Install a JAR module from a remote file system.
source => 'http://central.maven.org/maven2/org/postgresql/postgresql/9.3-1103-jdbc4/postgresql-9.3-1103-jdbc4.jar',
dependencies => ['javax.api', 'javax.transaction.api']
}

## Datasources

Setup a driver and a datasource:
Expand All @@ -144,7 +144,7 @@ Setup a driver and a datasource:
'password' => 'postgres'
}
}

Alternatively, you can install a JDBC driver and module using deploy if your driver is JDBC4 compliant:

wildfly::standalone::deploy { 'postgresql-9.3-1103-jdbc4.jar':
Expand Down Expand Up @@ -239,13 +239,13 @@ Some configurations like SSL and modcluster requires a server reload, it can be

## Instructions for Developers

This module is based on three custom types:
This module is based on three custom types:

wildfly_cli { 'Enable ExampleDS'
command => '/subsystem=datasources/data-source=ExampleDS:enable',
unless => '(result == true) of /subsystem=datasources/data-source=ExampleDS:read-attribute(name=enabled)'
}

wildfly_resource { '/subsystem=datasources/data-source=ExampleDS':
state => {
'driver-name' => 'postgresql',
Expand All @@ -255,11 +255,26 @@ This module is based on three custom types:
'password' => 'postgres'
}
}

wildfly_deploy { 'sample.war':
source => 'file:/vagrant/sample.war'
}

They all require a management username, password, host and port params, as it uses Wildfly HTTP API. *Host defaults to 127.0.0.1 and port to 9990*
They all require a management username, password, host and port params, as it uses Wildfly HTTP API. *Host defaults to 127.0.0.1 and port to 9990*

You can do virtually any Wildfly configuration using these custom types. Also this modules provides some defines in wildfly::standalone namespace which are built on top of these custom types. They are intended to enforce good practices, syntax sugar or serve as examples.

## Testing

gem install bundler --no-rdoc --no-ri
bundle install --without development
gem update --system 2.1.11

bundle exec rake syntax
bundle exec rake lint
bundle exec rubocop

bundle exec rake ci:setup:rspec spec
bundle exec rspec spec/acceptance # default centos-66-x64
BEAKER_set=centos-70-x64 bundle exec rspec spec/acceptance
BEAKER_set=debian-78-x64 bundle exec rspec spec/acceptance
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ require 'pathname'
require 'ci/reporter/rake/rspec'
require 'puppet_blacksmith/rake_tasks'

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc "Run the tests"
RSpec::Core::RakeTask.new(:test) do |t|
t.rspec_opts = ['--color', '-f d']
Expand Down
47 changes: 31 additions & 16 deletions spec/acceptance/acceptance_1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,46 @@

context 'Initial install Wildfly and verification' do
it 'Should apply the manifest without error' do

pp = <<-EOS
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
class { 'wildfly':
java_home => $java_home,
config => 'standalone-full-ha.xml',
}
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
class { 'wildfly':
java_home => $java_home,
config => 'standalone-full-ha.xml',
}
class { 'java': }
class { 'java': }
Class['java'] ->
Class['wildfly']
Class['java'] -> Class['wildfly']
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0, 2])
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
shell('sleep 15')
end
it 'Should be serving welcome page on port 8080' do

it 'service wildfly' do
expect(service 'wildfly').to be_enabled
expect(service 'wildfly').to be_running
end

it 'runs on port 8080' do
expect(port 8080).to be_listening
end

it 'welcome page' do
shell('curl localhost:8080', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/Welcome/)
expect(r.stdout).to include 'Welcome'
end
end

end

end
end
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/centos-70-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
centos-70-x64:
roles:
- agent
- default
platform: el-7-x86_64
box : puppetlabs/centos-7.0-64-puppet
hypervisor : vagrant

CONFIG:
type: foss
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/debian-78-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
debian-78-x64:
roles:
- agent
- default
platform: debian-7-amd64
box: puppetlabs/debian-7.8-64-puppet
hypervisor: vagrant

CONFIG:
type: foss
2 changes: 2 additions & 0 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ HOSTS:
centos-66-x64:
roles:
- agent
- default
platform: el-6-x86_64
box : puppetlabs/centos-6.6-64-puppet
hypervisor : vagrant

CONFIG:
type: foss
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'rspec-puppet'
require 'puppetlabs_spec_helper/module_spec_helper'

fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))

# include common helpers
support_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec/support/*.rb'))
Dir[support_path].each { |f| require f }
Expand Down
7 changes: 6 additions & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'

# hosts.each do |host|
# # Install Puppet
# on host, install_puppet
# end

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

Expand All @@ -11,7 +16,7 @@
hosts.each do |host|
on host, puppet('module', 'install', 'puppetlabs-stdlib', '--force', '--version', '3.2.0'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'nanliu/archive', '--version', '0.3.0'), :acceptable_exit_codes => [0, 1]
on host, puppet('module','install','puppetlabs-java'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-java'), { :acceptable_exit_codes => [0, 1] }
end
end
end
3 changes: 3 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ gem update --system 2.1.11
bundle exec rake syntax
bundle exec rake lint
bundle exec rake ci:setup:rspec spec
bundle exec rspec spec/acceptance
BEAKER_set=centos-70-x64 bundle exec rspec spec/acceptance
BEAKER_set=debian-78-x64 bundle exec rspec spec/acceptance
bundle exec rubocop
#bundle exec rake spec

Expand Down

0 comments on commit 7a2a089

Please sign in to comment.