Git Product home page Git Product logo

rspec-hiera-puppet's People

Contributors

amfranz avatar haf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rspec-hiera-puppet's Issues

Doesn't work properly with contexts

With the following example rspec:

context "test" do
  let :hiera_data do
    { :test => "fu" }
  end
  it { should contain_notify("foo").with_message("fu") }
end

context "test-2" do
    let :hiera_data do
    { :test => "bar" }
  end
  it { should contain_notify("foo").with_message("bar") }
end

The first and second will pass if run individually but when run one after the other it appears that hiera_data in the second context (:test => "bar") is not set and that the first one is still used (:test => "fu").

Can't get the basics working

Hi,

I can't tell if I'm doing something terribly stupid but when I try to just let(:hiera_data) it fails as you can see below. This is with just a gem install (as well as a gem install from a package made out of git just in case):

Failures:

  1. lms::config with ::edx set to true
    Failure/Error: )
    Puppet::Error:
    Could not find data item ssh_content_deploy in any Hiera data file and no default supplied at /home/apenney/git/configuration/modules/lms/spec/fixtures/modules/lms/manifests/config.pp:51 on node archlinux.mit.edu

    ./spec/classes/config_spec.rb:15:in `block (3 levels) in <top (required)>'


apenney@archlinux ~/git/configuration/modules/lms$ cat spec/classes/config_spec.rb
require 'spec_helper'

describe "lms::config" do
let(:params) { {
:virtualenv => '/opt/edx',
} }

context 'with ::edx set to true' do
let(:facts) { {:edx => true, :ssh_content_deploy => 'keyhere' } }
let(:hiera_data) { { :ssh_content_deploy => 'beep' } }

it do
  should contain_edx__admin('content_deploy').with(
    'public_key' => 'keyhere',
  )
end

end

end


apenney@archlinux ~/git/configuration/modules/lms$ cat spec/spec_helper.rb
require 'rubygems'
require 'rspec-hiera-puppet'
require 'puppetlabs_spec_helper/module_spec_helper'

Catalog issue

The catalog is being built wrong on boolean values.

if you have in the manifest:

$should_do = str2bool(hiera('should_do'))
if $should_do {
  notify { 'should': message => '$should_do was true', }
} else {
  notify { 'should_not': message => '$should_do was false', }
}

This test passes correctly:

  let($hiera_data) { { :should_do => 'true' } }
  it { should contain_notify('should') }
  it { should_not contain_notify('should_not') }

This test fails incorrectly:

  let($hiera_data) { { :should_do => 'false' } }
  it { should_not contain_notify('should') }
  it { should contain_notify('should_not') }

Requires puppet and facter as gems

Hi,

On my RHEL machine I have puppet and facter installed via RPMS. When I installed rspec-hiera-puppet (via gem) it forcibly installed both gems slapping itself on top of the rpm copies. Is there any chance you could remove this (or detect puppet differently) for people with packaged versions?

gem rspec-puppet 1.0.1 breaks rspec-hiera-puppet

I am not sure with which version of rspec-puppet the break first occurs but the 1.0.1 does not work (unit tests), 0.1.6 does work.

  • gem 'rspec-puppet', '~> 1.0.1'
  • gem 'rspec-puppet', '~> 0.1.6'

The error

Error: Error from DataBinding 'hiera' while looking up '*first parameter *' : no implicit conversion of Hash into String on node XXXXXX

It does not matter if the parameter is using hiera or not, you can even take out all mention of hiera and you will still get the error as long as long as spec_helper.rb contains require 'rspec-hiera-puppet'.

Googling this error it seems this is one of those errors that gives you bad info and misdirects, it has nothing to do with hash but a badly formed hiera file.... at least in the context of getting this on a normal puppet apply and not a unit test.

Hiera resolution issue

I'm trying to unit-test using this gem...

Have a look at this

https://github.com/haf/puppet-riak/blob/9f7c95cdc46019af9503717b07a928e63d9d9857/spec/classes/vmargs_spec.rb#L26

This is the order in which I expect hiera to choose values:

  1. From riak::vmargs class spec's :params
  2. From riak::vmargs class spec's :hiera_data
  3. From shared_context 'hieradata''s :hiera_data
  4. From riak::params
  5. From riak::vmargs( $absent = hiera('absent', 'false') ) - the default just by the class parameter

But it seems that the default value from the hiera function overrides everything from within the rspec's hiera_data.

Perhaps @haus could have a look at this as well?

I might be doing something wrong...

To try it:

bundle
bundle exec rake specs

Cannot get the basic example to work

Hi there,

i tried for some hours but cannot even get the basic example from the Readme to do anything - I basically always end up with a
Could not find data item foo_message in any Hiera data file and no default supplied

For what I can tell the configuration bits to hiera_config never make it into my puppet environment (unless I directly assign a file to Puppet.settings[:hiera_config]). The backend itself appears to work.

pls see https://gist.github.com/4198268

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.