mirror of
https://github.com/voxpupuli/puppet-hashi_stack.git
synced 2025-05-24 19:05:01 +01:00
adding acceptance setup
This commit is contained in:
parent
1822503711
commit
fe9ef733e1
4 changed files with 103 additions and 5 deletions
30
README.md
30
README.md
|
@ -1,2 +1,30 @@
|
|||
# puppet-hashi_stack
|
||||
This module contains shared code for various HashiCorp modules
|
||||
|
||||
[](https://forge.puppetlabs.com/puppet/hashi_stack)
|
||||
[](https://forge.puppetlabs.com/puppet/hashi_stack)
|
||||
[](https://forge.puppetlabs.com/puppet/hashi_stack)
|
||||
[](https://forge.puppetlabs.com/puppet/hashi_stack)
|
||||
[](http://www.puppetmodule.info/m/puppet-hashi_stack)
|
||||
[](LICENSE)
|
||||
|
||||
### What This Module Affects
|
||||
|
||||
* Installs the hashicorp repositories
|
||||
|
||||
## Reference
|
||||
|
||||
See [REFERENCE](REFERENCE.md).
|
||||
|
||||
## Limitations
|
||||
|
||||
Depends on the JSON gem, or a modern ruby. (Ruby 2.5 and newer are supported)
|
||||
|
||||
## Development
|
||||
|
||||
Vox Pupuli welcomes new contributions to this
|
||||
module, especially those that include documentation and rspec tests. We are
|
||||
happy to provide guidance if necessary.
|
||||
|
||||
Open an [issue](https://github.com/voxpupuli/puppet-hashi_stack/issues) or
|
||||
[fork](https://github.com/voxpupuli/puppet-hashi_stack/fork) and open a
|
||||
[Pull Request](https://github.com/voxpupuli/puppet-hashi_stack/pulls)
|
||||
|
|
|
@ -1,2 +1,56 @@
|
|||
# hashi_stack::repo
|
||||
#
|
||||
class hashi_stack::repo {}
|
||||
# @summary Set up the package repository for the HashiCorp Stack components
|
||||
#
|
||||
# @example
|
||||
# include hashi_stack::repo
|
||||
#
|
||||
# @param priority A numeric priority for the repo, passed to the package management system
|
||||
# @param proxy The URL of a HTTP proxy to use for package downloads (YUM only)
|
||||
# @param base_repo_url The base url for the repo path
|
||||
class hashi_stack::repo (
|
||||
Optional[Integer] $priority = undef,
|
||||
String $proxy = 'absent',
|
||||
) {
|
||||
$key_id='E8A032E094D8EB4EA189D270DA418C88A3219F7B'
|
||||
$key_source='https://apt.releases.hashicorp.com/gpg'
|
||||
$description='HashiCorp package repository.'
|
||||
|
||||
case $facts['os']['family'] {
|
||||
'Debian': {
|
||||
include apt
|
||||
|
||||
apt::source { 'HashiCorp':
|
||||
ensure => 'present',
|
||||
architecture => 'amd64',
|
||||
comment => $description,
|
||||
location => 'https://apt.releases.hashicorp.com',
|
||||
release => 'stable',
|
||||
repos => 'main',
|
||||
key => {
|
||||
'id' => $key_id,
|
||||
'source' => $key_source,
|
||||
},
|
||||
include => {
|
||||
'deb' => true,
|
||||
'src' => false,
|
||||
},
|
||||
pin => $priority,
|
||||
}
|
||||
}
|
||||
'RedHat', 'Linux': {
|
||||
yumrepo { 'HashiCorp':
|
||||
descr => $description,
|
||||
baseurl => 'https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable',
|
||||
gpgcheck => 1,
|
||||
gpgkey => $key_source,
|
||||
enabled => 1,
|
||||
proxy => $proxy,
|
||||
priority => $priority,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("\"${module_name}\" provides no repository information for OSfamily \"${facts['os']['family']}\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
17
spec/acceptance/standard_spec.rb
Normal file
17
spec/acceptance/standard_spec.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'hashi_stack::repo class' do
|
||||
|
||||
context 'default parameters' do
|
||||
# Using puppet_apply as a helper
|
||||
it 'should work with no errors based on the example' do
|
||||
pp = <<-EOS
|
||||
class { 'hashi_stack::repo': }
|
||||
EOS
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
expect(apply_manifest(pp).exit_code).to_not eq(1)
|
||||
expect(apply_manifest(pp).exit_code).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,9 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nomad' do
|
||||
describe 'hashi_stack::repo' do
|
||||
on_supported_os.each do |os, os_facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { os_facts.merge(service_provider: 'systemd') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue