diff options
author | Louis-Philippe VĂ©ronneau <pollito@riseup.net> | 2018-02-02 19:22:51 +0000 |
---|---|---|
committer | Louis-Philippe VĂ©ronneau <pollito@riseup.net> | 2018-02-02 19:22:51 +0000 |
commit | 9d783e91beb5356d5a6e2573292690d5998becac (patch) | |
tree | 8cf3d84d96c1c75d002d5ee0bc9efa567fcb6344 | |
parent | 90cb24c6e0916b27eae744e5f6ecaa84a180517c (diff) | |
parent | d0b3003bd94aca6022823cb79c3eee5a84724623 (diff) |
Merge branch 'ci-update' into 'master'
Update the CI tests
See merge request shared-puppet-modules-group/tor!18
-rw-r--r-- | .gitlab-ci.yml | 43 | ||||
-rw-r--r-- | Gemfile | 29 | ||||
-rw-r--r-- | Rakefile | 25 | ||||
-rw-r--r-- | manifests/daemon/relay.pp | 2 | ||||
-rw-r--r-- | spec/acceptance/nodesets/default.yml | 19 | ||||
-rw-r--r-- | spec/spec_helper.rb | 12 | ||||
-rw-r--r-- | spec/spec_helper_acceptance.rb | 18 |
7 files changed, 30 insertions, 118 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 611058c..21907f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,20 @@ -image: ruby:2.1 -before_script: - - bundle install --jobs $(nproc) --without system_tests --path=/var/cache/gitlab-runner/ "${FLAGS[@]}" +image: ruby:2.3 -.job_template: &job_definition +# Test job template +.test_template: &test_definition + stage: test script: - # don't fail on lint warnings - - bundle exec rake lint || /bin/true - - bundle exec rake syntax - - bundle exec rake validate - - bundle exec rake spec + - bundle install --jobs $(nproc) --without docs --path vendor + - bundle exec rake tests -# Default debian jessie versions -test:puppet37: - variables: - PUPPET_VERSION: "~> 3.7.2" - FACTER_VERSION: '~> 2.2.0' - <<: *job_definition - -test:puppet38_future_parser: - variables: - PUPPET_VERSION: '~> 3.8' - FACTER_VERSION: '~> 2.2.0' - FUTURE_PARSER: 'yes' - <<: *job_definition - -# Default debian stretch versions +# Test with version present on Debian stable test:puppet48: variables: PUPPET_VERSION: "~> 4.8.2" FACTER_VERSION: '~> 2.4.6' - <<: *job_definition + HIERA_VERSION: '~> 3.2.0' + <<: *test_definition -# Latest greatest -test:puppet4x: - variables: - PUPPET_VERSION: "> 4" - FACTER_VERSION: '> 2' - <<: *job_definition +# Test with latest Puppet release +test:puppetlatest: + <<: *test_definition @@ -1,23 +1,12 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -group :development, :unit_tests do - gem "rake" - gem "rspec-puppet", "~> 2.1", :require => false - gem "rspec-core" - gem "puppetlabs_spec_helper" - gem "semantic_puppet" - gem "metadata-json-lint" - gem "rspec-puppet-facts" - gem "mocha" -end +gem 'rake' +gem 'puppet', ENV['PUPPET_VERSION'] -group :system_tests do - gem 'beaker' - gem 'beaker-rspec' - gem 'beaker_spec_helper' - gem 'serverspec' +group :tests do + gem 'facter', ENV['FACTER_VERSION'] + gem 'hiera', ENV['HIERA_VERSION'] + gem 'puppetlabs_spec_helper' + gem 'metadata-json-lint' + gem 'semantic_puppet' end - -gem "puppet", ENV['PUPPET_VERSION'] || ENV['GEM_PUPPET_VERSION'] || ENV['PUPPET_GEM_VERSION'] || '~> 3.7.0' -gem "facter", ENV['FACTER_VERSION'] || ENV['GEM_FACTER_VERSION'] || ENV['FACTER_GEM_VERSION'] || '~> 2.2.0' - @@ -1,19 +1,10 @@ -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"] +task :tests do + require 'puppetlabs_spec_helper/rake_tasks' -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/ - end - Dir['templates/**/*.erb'].each do |template| - sh "erb -P -x -T '-' #{template} | ruby -c" - end -end + # run syntax checks on manifests, templates and hiera data + # also runs :metadata_lint + Rake::Task[:validate].invoke -task :test => [:lint, :syntax , :validate, :spec] + # runs puppet-lint + Rake::Task[:lint].invoke +end diff --git a/manifests/daemon/relay.pp b/manifests/daemon/relay.pp index fa908f5..9ba2323 100644 --- a/manifests/daemon/relay.pp +++ b/manifests/daemon/relay.pp @@ -13,7 +13,7 @@ define tor::daemon::relay( $relay_bandwidth_burst = 0, # GB, 0 for no limit $accounting_max = 0, - $accounting_start = "month 1 0:00", + $accounting_start = 'month 1 0:00', $contact_info = '', # TODO: autofill with other relays $my_family = '', diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 100644 index f09ad62..0000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1,19 +0,0 @@ -HOSTS: - debian-8-x64: - platform: debian-8-amd64 - image: debian:8 - hypervisor: docker - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get install -y wget locales-all puppet git' - - 'rm -f /usr/sbin/policy-rc.d' - -CONFIG: - type: foss - #log_level: verbose - #log_level: debug - -ssh: - password: root - auth_methods: ["password"] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 3cca63a..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,12 +0,0 @@ -# https://puppetlabs.com/blog/testing-modules-in-the-puppet-forge -require 'puppetlabs_spec_helper/module_spec_helper' - -fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) - -RSpec.configure do |c| - - c.manifest_dir = File.join(fixture_path, 'manifests') - c.module_path = File.join(fixture_path, 'modules') - - c.color = true -end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb deleted file mode 100644 index e6a2cd8..0000000 --- a/spec/spec_helper_acceptance.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'beaker-rspec' - -RSpec.configure do |c| - module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - module_name = module_root.split('-').last - - # Readable test descriptions - c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - # Install module and dependencies - puppet_module_install(:source => module_root, :module_name => module_name) - hosts.each do |host| - shell('git clone https://github.com/puppetlabs/puppetlabs-concat.git /etc/puppet/modules/concat') - end - end -end |