Skip to content

Commit

Permalink
Merge branch 'basic_linting_tests' into 'master'
Browse files Browse the repository at this point in the history
Fixes #1 - Add basic linting / spec tests

Closes #1

See merge request !1
  • Loading branch information
tepeds committed Jan 5, 2017
2 parents e84a068 + 8ca42e4 commit 38f6c32
Show file tree
Hide file tree
Showing 22 changed files with 227 additions and 112 deletions.
6 changes: 6 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
symlinks:
shibidp: "#{source_dir}"
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
stages:
- test

test:
stage: test
script:
- bundle install --without system_tests development --path vendor/bundle --jobs=3 --retry=3
- bundle exec rake test SPEC_OPTS='--format documentation'
tags:
- ruby21
cache:
paths:
- vendor/bundle
49 changes: 49 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# RuboCop config file
# Configure cops
# https://github.com/bbatsov/rubocop
# https://github.com/bbatsov/rubocop/blob/master/config/default.yml
# https://github.com/bbatsov/ruby-style-guide
#

AllCops:
Include:
- '**/*.gemspec'
- '**/*.rake'
- '**/Gemfile'
- '**/Puppetfile'
- '**/Rakefile'
- '**/Guardfile'
Exclude:
- 'modules/**/*'
- 'pkg/**/*'
- 'spec/fixtures/**/*'
- 'vendor/**/*'
DisplayCopNames: true

#################### Style ##################################

# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles.
# Support ruby 1.8.7
Style/HashSyntax:
EnforcedStyle: hash_rockets

# The shebang stuff at the top triggers this
Style/LeadingCommentSpace:
Exclude:
- Puppetfile

#################### Metrics ################################

Metrics/LineLength:
# Ruduce this... Max: 80
Max: 111

Metrics/BlockLength:
# Ruduce this... Max: 25
Max: 27

##################### Bundler #############################

Bundler/DuplicatedGem:
Enabled: false
1 change: 1 addition & 0 deletions .ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puppet-module
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.10
29 changes: 20 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :unit_tests do
gem 'rubocop', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'metadata-json-lint', :require => false
gem 'json', :require => false
gem 'json_pure', '1.8.3', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet-lint-absolute_classname-check', :require => false
gem 'puppet-lint-absolute_template_path', :require => false
gem 'puppet-lint-alias-check', :require => false
Expand All @@ -28,18 +24,33 @@ group :unit_tests do
gem 'puppet-lint-usascii_format-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'puppet-lint-version_comparison-check', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rubocop', '~> 0.41.2', :require => false if RUBY_VERSION =~ /^1\.9/
gem 'rubocop', :require => false if RUBY_VERSION =~ /^2\./
end

group :development do
gem 'simplecov', :require => false
gem 'librarian-puppet', :require => false
gem 'simplecov', :require => false
end

group :system_tests do
gem 'beaker-rspec', :require => false
gem 'serverspec', :require => false
if RUBY_VERSION < '2.2.5'
# beaker 3.1+ requires ruby 2.2.5. Lock to 2.0
gem 'beaker', '~> 2.0', :require => false
# beaker-rspec 6.0.0 requires beaker 3.0. Lock to 5.0
gem 'beaker-rspec', '~> 5.0', :require => false
else
gem 'beaker-rspec', :require => false
end
gem 'serverspec', :require => false
end

# json_pure 2.0.2 added a requirement on ruby >= 2. We pin to json_pure 2.0.1
# if using ruby 1.x
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION =~ /^1\./

if (facterversion = ENV['FACTER_GEM_VERSION'])
gem 'facter', facterversion, :require => false
else
Expand All @@ -49,7 +60,7 @@ end
if (puppetversion = ENV['PUPPET_GEM_VERSION'])
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', '~> 3.8', :require => false
gem 'puppet', '~> 4.8', :require => false
end

# vim:ft=ruby
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ENV['FUTURE_PARSER'] ||= 'yes'

require 'rubygems' if RUBY_VERSION < '1.9.0'
# require 'rubocop/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'
Expand Down
22 changes: 11 additions & 11 deletions manifests/attribute_filter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@

# Create the attribute-filter.xml configuration file.
concat { 'attribute-filter.xml':
path => "${shibidp::shib_install_base}/conf/attribute-filter.xml",
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0600',
path => "${shibidp::shib_install_base}/conf/attribute-filter.xml",
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0600',
}

concat::fragment { 'attribute_filter_head':
target => 'attribute-filter.xml',
order => '01',
content => template("${module_name}/shibboleth/attribute_filter/_attribute_filter_head.erb")
target => 'attribute-filter.xml',
order => '01',
content => template("${module_name}/shibboleth/attribute_filter/_attribute_filter_head.erb"),
}

concat::fragment { 'attribute_filter_foot':
target => 'attribute-filter.xml',
order => '99',
content => template("${module_name}/shibboleth/attribute_filter/_attribute_filter_foot.erb")
target => 'attribute-filter.xml',
order => '99',
content => template("${module_name}/shibboleth/attribute_filter/_attribute_filter_foot.erb"),
}

create_resources('shibidp::attribute_filter::policy', $shibidp::filters)

}
}
6 changes: 3 additions & 3 deletions manifests/attribute_filter/policy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
) {

concat::fragment { "attribute_filter_policy_${id}":
target => 'attribute-filter.xml',
order => '20',
content => template("${module_name}/shibboleth/attribute_filter/_policy.erb")
target => 'attribute-filter.xml',
order => '20',
content => template("${module_name}/shibboleth/attribute_filter/_policy.erb"),
}

}
30 changes: 15 additions & 15 deletions manifests/attribute_resolver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@

# Create the dataconnectors.properties file.
concat { 'dataconnectors.properties':
path => "${shibidp::shib_install_base}/conf/dataconnectors.properties",
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0600',
path => "${shibidp::shib_install_base}/conf/dataconnectors.properties",
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0600',
}

# Create the attribute-resolver.xml configuration file.
concat { 'attribute-resolver.xml':
path => "${shibidp::shib_install_base}/conf/attribute-resolver.xml",
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0600',
path => "${shibidp::shib_install_base}/conf/attribute-resolver.xml",
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0600',
}

concat::fragment { 'attribute_resolver_head':
target => 'attribute-resolver.xml',
order => '01',
content => template("${module_name}/shibboleth/attribute_resolver/_attribute_resolver_head.erb")
target => 'attribute-resolver.xml',
order => '01',
content => template("${module_name}/shibboleth/attribute_resolver/_attribute_resolver_head.erb"),
}

concat::fragment { 'attribute_resolver_foot':
target => 'attribute-resolver.xml',
order => '99',
content => template("${module_name}/shibboleth/attribute_resolver/_attribute_resolver_foot.erb")
target => 'attribute-resolver.xml',
order => '99',
content => template("${module_name}/shibboleth/attribute_resolver/_attribute_resolver_foot.erb"),
}

create_resources('shibidp::attribute_resolver::dataconnector', $shibidp::dataconnectors)
create_resources('shibidp::attribute_resolver::attribute', $shibidp::attributes)

}
}
6 changes: 3 additions & 3 deletions manifests/attribute_resolver/attribute.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
) {

concat::fragment { "attribute_resolver_attribute_${id}":
target => 'attribute-resolver.xml',
order => '20',
content => template("${module_name}/shibboleth/attribute_resolver/_attribute.erb")
target => 'attribute-resolver.xml',
order => '20',
content => template("${module_name}/shibboleth/attribute_resolver/_attribute.erb"),
}

}
22 changes: 11 additions & 11 deletions manifests/attribute_resolver/dataconnector.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
) {

concat::fragment { "attribute_resolver_dataconnector_${id}":
target => 'attribute-resolver.xml',
order => '80',
content => template("${module_name}/shibboleth/attribute_resolver/_dataconnector.erb")
target => 'attribute-resolver.xml',
order => '80',
content => template("${module_name}/shibboleth/attribute_resolver/_dataconnector.erb"),
}

if $type == 'LDAPDirectory' {
concat::fragment { "dataconnector_properties_${id}":
target => 'dataconnectors.properties',
order => '10',
content => template("${module_name}/shibboleth/attribute_resolver/_ldap_properties.erb")
target => 'dataconnectors.properties',
order => '10',
content => template("${module_name}/shibboleth/attribute_resolver/_ldap_properties.erb"),
}
}

if $ldap_trust_cert_source {
file { "${shibidp::shib_install_base}/${ldap_filter_tls_trust_cert}":
ensure => file,
source => $ldap_trust_cert_source,
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0644',
ensure => file,
source => $ldap_trust_cert_source,
owner => $shibidp::shib_user,
group => $shibidp::shib_group,
mode => '0644',
}
}
}
14 changes: 7 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$idp_entity_id = $shibidp::params::idp_entity_id,
$idp_server_url = $shibidp::params::idp_server_url,
$idp_server_name = $shibidp::params::idp_server_name,

$include_cas = $shibidp::params::include_cas,
$cas_server_url = $shibidp::params::cas_server_url,

Expand All @@ -30,7 +30,7 @@
$logback_version = $shibidp::params::logback_version,
$logback_checksum_type = $shibidp::params::logback_checksum_type,
$logback_checksum = $shibidp::params::logback_checksum,

$ks_password = $shibidp::params::ks_password,

$relying_party_profiles = $shibidp::params::relying_party_profiles,
Expand All @@ -49,10 +49,10 @@
class { '::shibidp::attribute_resolver': } ->
class { '::shibidp::attribute_filter': }

contain shibidp::install
contain shibidp::relying_party
contain shibidp::metadata
contain shibidp::attribute_resolver
contain shibidp::attribute_filter
contain '::shibidp::install'
contain '::shibidp::relying_party'
contain '::shibidp::metadata'
contain '::shibidp::attribute_resolver'
contain '::shibidp::attribute_filter'

}
32 changes: 16 additions & 16 deletions manifests/jetty.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

if $jetty_manage_user {
ensure_resource('user', $jetty_user, {
managehome => true,
system => true,
gid => jetty_group,
shell => '/sbin/nologin',
managehome => true,
system => true,
gid => jetty_group,
shell => '/sbin/nologin',
})

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

Expand All @@ -35,19 +35,19 @@
extract_path => $jetty_home,
cleanup => false,
creates => "${jetty_home}/jetty-distribution-${jetty_version}/README.TXT",
notify => Service["jetty"]
notify => Service['jetty'],
} ->

file { "${jetty_home}/jetty":
ensure => 'link',
target => "${jetty_home}/jetty-distribution-${jetty_version}",
} ->

file { "/var/log/jetty":
file { '/var/log/jetty':
ensure => "${jetty_home}/jetty/logs",
} ->

file { "/etc/init.d/jetty":
file { '/etc/init.d/jetty':
ensure => "${jetty_home}/jetty-distribution-${jetty_version}/bin/jetty.sh",
}

Expand All @@ -58,17 +58,17 @@
# before => Service['jetty'],
# }
file { '/usr/lib/systemd/system/jetty.service':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => template("${module_name}/jetty/jetty.service.erb"),
}
}

service { "jetty":
enable => true,

service { 'jetty':
ensure => $jetty_service_ensure,
enable => true,
hasstatus => false,
hasrestart => true,
}
Expand Down
Loading

0 comments on commit 38f6c32

Please sign in to comment.