Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic acceptance tests
Browse files Browse the repository at this point in the history
smortex committed Feb 17, 2022
1 parent e1ed764 commit 7242fad
Showing 4 changed files with 64 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -57,9 +57,33 @@ jobs:
- name: Run tests
run: bundle exec rake parallel_spec

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
20 changes: 20 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'syslog_ng class' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'syslog_ng':
manage_repo => true,
}
syslog_ng::config { 'version':
content => '@version: 3.30',
order => '02',
}
PUPPET
end
end
end
14 changes: 14 additions & 0 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Needed for facter to fetch facts used by the apt module
if $facts['os']['name'] == 'Ubuntu' {
package{ 'lsb-release':
ensure => present,
}
}

# FIXME: Workaroud for:
# https://github.com/puppetlabs/puppetlabs-apt/pull/1015
if $facts['os']['name'] == 'Debian' {
package{ 'apt-transport-https':
ensure => present,
}
}
10 changes: 6 additions & 4 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# DO NOT EDIT THIS FILE!
# This file is managed by ModuleSync.
#
# frozen_string_literal: true

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

require 'voxpupuli/acceptance/spec_helper_acceptance'

configure_beaker
configure_beaker do |host|
install_module_from_forge_on(host, 'puppetlabs/apt', '>= 0')
end

Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }

0 comments on commit 7242fad

Please sign in to comment.