-
Notifications
You must be signed in to change notification settings - Fork 202
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
allow testing environment functions #661
base: master
Are you sure you want to change the base?
Conversation
a65889b
to
73ee418
Compare
73ee418
to
e10d6e2
Compare
Given the pain this is causing to test, and that I see no good reason for Internal ref: https://puppet.slack.com/archives/CF466J67L/p1603713702132700 , https://puppet.slack.com/archives/CF418Q1M2/p1603738590085200 |
After tracing through the tickets and code changes, I'm still not 100% clear on the history of "environment functions". The best I could determine is they were probably introduced as a side-effect to loader changes for the Puppet 4 function API (see puppetlabs/puppet#2546 puppetlabs/puppet#5455) and then someone decided to document it. My suggestion of moving those functions to a module called I'm still having a hard time coming up with a use-case where this capability is useful for a production server/agent setup in a way that couldn't also be addressed by having said functions in a module (even if it is not called "environment"). Therefore I'm still in the camp of "it's not worth jumping through all the hoops for getting the test moons aligned just right". |
Bumping this from the 2.8.x release since it sounds like it may just not get implemented. |
I was having a similar issue with a namespace function. It appears that testing a function only works when the function is in a directory with the module name. Which in this case is: |
This is probably the wrong way to achieve the outcome, it's just what I did to get it working and figured it should be shared.
Scenario
As per https://puppet.com/docs/puppet/5.3/functions_ruby_overview.html#location I have an "environment function" named
environment::upcase
and I want to test it. My test code looks likeIssue
Running the tests as-is fails with
Workaround
This MR allows the test to succeed