-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from dylanratcliffe/fix_function_mocking
Fix function mocking
- Loading branch information
Showing
10 changed files
with
125 additions
and
2 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
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 @@ | ||
.onceover |
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,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'onceover' |
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,17 @@ | ||
forge "http://forge.puppetlabs.com" | ||
# | ||
# I want to download some modules to check if r10k feature in Onceover works correctly. | ||
# | ||
|
||
# Versions should be updated to be the latest at the time you start | ||
mod "puppetlabs/stdlib", '4.11.0' | ||
|
||
# Modules from Git | ||
# Examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples | ||
mod 'apache', | ||
:git => 'https://github.com/puppetlabs/puppetlabs-apache', | ||
:commit => '83401079053dca11d61945bd9beef9ecf7576cbf' | ||
|
||
#mod 'apache', | ||
# :git => 'https://github.com/puppetlabs/puppetlabs-apache', | ||
# :branch => 'docs_experiment' |
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 @@ | ||
require 'onceover/rake_tasks' |
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,2 @@ | ||
modulepath = site:modules:$basemodulepath | ||
config_version = 'scripts/config_version.sh $environmentpath $environment' |
32 changes: 32 additions & 0 deletions
32
spec/fixtures/controlrepos/function_mocking/manifests/site.pp
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,32 @@ | ||
## site.pp ## | ||
|
||
# This file (/etc/puppetlabs/puppet/manifests/site.pp) is the main entry point | ||
# used when an agent connects to a master and asks for an updated configuration. | ||
# | ||
# Global objects like filebuckets and resource defaults should go in this file, | ||
# as should the default node definition. (The default node can be omitted | ||
# if you use the console and don't define any other nodes in site.pp. See | ||
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on | ||
# node definitions.) | ||
|
||
## Active Configurations ## | ||
|
||
# Disable filebucket by default for all File resources: | ||
#https://docs.puppet.com/pe/2015.3/release_notes.html#filebucket-resource-no-longer-created-by-default | ||
File { backup => false } | ||
|
||
# DEFAULT NODE | ||
# Node definitions in this file are merged with node data from the console. See | ||
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on | ||
# node definitions. | ||
|
||
# The default node definition matches any node lacking a more specific node | ||
# definition. If there are no other nodes in this file, classes declared here | ||
# will be included in every node's catalog, *in addition* to any classes | ||
# specified in the console for that node. | ||
|
||
node default { | ||
# This is where you can declare classes for all nodes. | ||
# Example: | ||
# class { 'my_class': } | ||
} |
19 changes: 19 additions & 0 deletions
19
spec/fixtures/controlrepos/function_mocking/site/role/manifests/test_functions.pp
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,19 @@ | ||
# == Class: role::test_functions | ||
# | ||
class role::test_functions { | ||
unless string('foo') =~ String { | ||
fail('string() did not return a string') | ||
} | ||
unless number('foo') =~ Numeric { | ||
fail('string() did not return a string') | ||
} | ||
unless boolean('foo') =~ Boolean { | ||
fail('string() did not return a string') | ||
} | ||
unless array('foo') =~ Array { | ||
fail('string() did not return a string') | ||
} | ||
unless hash('foo') =~ Hash { | ||
fail('string() did not return a string') | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
spec/fixtures/controlrepos/function_mocking/spec/onceover.yaml
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,43 @@ | ||
# Classes to be tested | ||
classes: | ||
- role::test_functions | ||
|
||
# Nodes to tests classes on, this refers to a 'factset' or 'nodeset' | ||
# depending on weather you are running 'spec' or 'acceptance' tests | ||
nodes: | ||
- CentOS-7.0-64 | ||
|
||
# You can group classes here to save typing | ||
class_groups: | ||
|
||
# You can group nodes here to save typing | ||
# We have created a 'non_windows_nodes' group because we can't | ||
# give you Windows vagrant boxes to test with because licensing, | ||
# we can give you fact sets though so go crazy with spec testing! | ||
node_groups: | ||
|
||
test_matrix: | ||
- all_nodes: | ||
classes: 'all_classes' | ||
tests: 'spec' | ||
|
||
functions: | ||
string: | ||
type: rvalue | ||
returns: string | ||
number: | ||
type: rvalue | ||
returns: 400 | ||
boolean: | ||
type: rvalue | ||
returns: true | ||
array: | ||
type: rvalue | ||
returns: | ||
- 1 | ||
- 2 | ||
- 3 | ||
hash: | ||
type: rvalue | ||
returns: | ||
foo: bar |
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