Skip to content

Commit

Permalink
Implement acceptance tests for webhook-go
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Sep 5, 2023
1 parent bc8f541 commit 47397ee
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ concurrency:
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
35 changes: 35 additions & 0 deletions spec/acceptance/r10k_webhook_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'r10k::webhook tests' do
context 'when defaults used' do
it 'applies' do
pp = <<-MANIFEST
class { 'r10k': }
-> class { 'r10k::webhook': }
MANIFEST

apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe package('webhook-go') do
it { is_expected.to be_installed }
end

describe file('/etc/voxpupuli/webhook.yml') do
it 'exists and has content' do
expect(subject).to exist
expect(subject).to be_owned_by 'root'
expect(subject).to be_grouped_into 'root'
expect(subject).to contain "---\nserver:\n protected: true\n user: puppet\n password: puppet\n"
end
end

describe service('webhook-go') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end
end
end
9 changes: 6 additions & 3 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# 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 do |host|
on host, puppet('resource', 'user', 'puppet', 'ensure=present')
end
configure_beaker(modules: :metadata)

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

0 comments on commit 47397ee

Please sign in to comment.