Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to have server_facts without servername #37

Open
ekohl opened this issue Jan 10, 2023 · 0 comments
Open

Impossible to have server_facts without servername #37

ekohl opened this issue Jan 10, 2023 · 0 comments
Labels

Comments

@ekohl
Copy link

ekohl commented Jan 10, 2023

Describe the Bug

When configuring rspec-puppet to provide the $server_facts hash it's impossible to unset the servername entry. However, that is what happens when you run Puppet serverless (i.e., puppet apply). This means it's impossible to have a single codebase be tested using rspec-puppet in both serverless and server-mode.

Expected Behavior

A way to (locally) control whether the environment pretends to be connected or not.

Steps to Reproduce

Configure the test suite with server facts

RSpec.configure do |c|
  c.trusted_server_facts = true
end

Then have code that uses $server_facts['servername']:

if $server_facts['servername'] {
  file { '/tmp/puppetserver':
    ensure  => file,
    content => $server_facts['servername'],
  }
}

Test this out with the following code:

it { is_expected.not_to contain_file('/tmp/puppetserver') }

This will fail, while it's expected to pass.

Environment

  • Version 2.12.0
  • Ruby 3.1.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant