-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
stages: | ||
- syntax | ||
- unit | ||
|
||
cache: | ||
paths: | ||
- vendor/bundle | ||
|
||
before_script: | ||
- bundle -v | ||
- rm Gemfile.lock || true | ||
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" | ||
- "# Set `rubygems_version` in the .sync.yml to set a value" | ||
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" | ||
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' | ||
- gem --version | ||
- bundle -v | ||
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc) | ||
|
||
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6: | ||
stage: syntax | ||
image: ruby:2.5.7 | ||
script: | ||
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop | ||
variables: | ||
PUPPET_GEM_VERSION: '~> 6' | ||
|
||
parallel_spec-Ruby 2.5.7-Puppet ~> 6: | ||
stage: unit | ||
image: ruby:2.5.7 | ||
script: | ||
- bundle exec rake parallel_spec | ||
variables: | ||
PUPPET_GEM_VERSION: '~> 6' | ||
|
||
parallel_spec-Ruby 2.4.5-Puppet ~> 5: | ||
stage: unit | ||
image: ruby:2.4.5 | ||
script: | ||
- bundle exec rake parallel_spec | ||
variables: | ||
PUPPET_GEM_VERSION: '~> 5' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"puppet.puppet-vscode", | ||
"rebornix.Ruby" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
|
||
## [0.1.0] | ||
|
||
**Features** | ||
|
||
* Initial project | ||
* Inventory plugin that returns GitLab group projects as `local` transport Targets | ||
* Example Bolt project with working Plans and `inventory.yaml` | ||
|
||
[Unreleased]: https://github.com/op-ct/puppet-gitlab_inventory | ||
[0.1.0]: https://github.com/op-ct/puppet-gitlab_inventory/releases/tag/0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Use default_module_facts.yml for module specific facts. | ||
# | ||
# Facts specified here will override the values provided by rspec-puppet-facts. | ||
--- | ||
ipaddress: "172.16.254.254" | ||
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" | ||
is_pe: false | ||
macaddress: "AA:AA:AA:AA:AA:AA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.configure do |c| | ||
c.mock_with :rspec | ||
end | ||
|
||
require 'puppetlabs_spec_helper/module_spec_helper' | ||
require 'rspec-puppet-facts' | ||
|
||
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) | ||
|
||
include RspecPuppetFacts | ||
|
||
default_facts = { | ||
puppetversion: Puppet.version, | ||
facterversion: Facter.version, | ||
} | ||
|
||
default_fact_files = [ | ||
File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), | ||
File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), | ||
] | ||
|
||
default_fact_files.each do |f| | ||
next unless File.exist?(f) && File.readable?(f) && File.size?(f) | ||
|
||
begin | ||
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) | ||
rescue => e | ||
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" | ||
end | ||
end | ||
|
||
# read default_facts and merge them over what is provided by facterdb | ||
default_facts.each do |fact, value| | ||
add_custom_fact fact, value | ||
end | ||
|
||
RSpec.configure do |c| | ||
c.default_facts = default_facts | ||
c.before :each do | ||
# set to strictest setting for testing | ||
# by default Puppet runs at warning level | ||
Puppet.settings[:strict] = :warning | ||
Puppet.settings[:strict_variables] = true | ||
end | ||
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] | ||
c.after(:suite) do | ||
end | ||
end | ||
|
||
# Ensures that a module is defined | ||
# @param module_name Name of the module | ||
def ensure_module_defined(module_name) | ||
module_name.split('::').reduce(Object) do |last_module, next_module| | ||
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) | ||
last_module.const_get(next_module, false) | ||
end | ||
end | ||
|
||
# 'spec_overrides' from sync.yml will appear below this line |