Skip to content

Commit

Permalink
Some minimal initial spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
buzzdeee committed Apr 11, 2017
1 parent 7fa57b4 commit 2a4bb43
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 19 deletions.
38 changes: 38 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
stages:
- test
- deploy

variables:
RUBYSUFFIX: '23'

puppet-lint:
script:
- "puppet-lint${RUBYSUFFIX} --relative --fail-on-warnings --with-filename --with-context manifests"
stage: test

template-test:
script:
- "if [ -d templates ];then"
- "erb$RUBYSUFFIX -x -T '-' templates/*erb | ruby${RUBYSUFFIX} -c"
- "fi"
stage: test

rubocop-test:
script:
- 'echo "inspecting following files with rubocop:"'
- "rubocop$RUBYSUFFIX -L"
- "rubocop$RUBYSUFFIX -l --only-guide-cops"
stage: test

rake-test:
script:
- "rake$RUBYSUFFIX spec SPEC_OPTS='--format documentation'"
stage: test

deploy:
script:
- "sudo /usr/local/bin/r10k${RUBYSUFFIX} deploy module newsyslog -v"
stage: deploy
only:
- master

6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AllCops:
TargetRubyVersion: 2.3
DisplayCopNames: true
DisplayStyleGuide: true
ExtraDetails: true
DefaultFormatter: simple
7 changes: 0 additions & 7 deletions Gemfile

This file was deleted.

10 changes: 6 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# frozen_string_literal: true

require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp']

desc "Validate manifests, templates, and ruby files"
desc 'Validate manifests, templates, and ruby files'
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec\/fixtures}
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
content => template('autoinstall/autoartitioning.erb'),
}
}

file { $instfilepath:
owner => 'root',
group => $wwwgroup,
Expand Down
7 changes: 0 additions & 7 deletions spec/classes/init_spec.rb

This file was deleted.

Empty file added spec/fixtures/manifests/site.pp
Empty file.
1 change: 1 addition & 0 deletions spec/fixtures/modules/autoinstall/manifests
1 change: 1 addition & 0 deletions spec/fixtures/modules/autoinstall/templates
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require 'puppetlabs_spec_helper/module_spec_helper'

0 comments on commit 2a4bb43

Please sign in to comment.