(FM-8342) Handle mocking of localhost #179
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit it was not possible to mock features when running
acceptance tests against localhost. This is because both specifying the
node name localhost causes bolt to ignore the inventory file and also
litmus passed an empty inventory file when calling the helpers against
localhost as the target node.
This commit makes some extensive additions and patches to the existing
behavior in order to enable mocking localhost during testing:
which will return a valid inventory hash containing only what bolt
needs to execute locally; it places the node litmus_localhost in
the local group and specifies the transport as local. This node CAN
NOT be named localhost or bolt will ignore the inventory file.
which will check to see if the specified node name is in the inventory
and return true if it does or false if it does not.
the logic reused throughout the serverspec methods for determining if
the command is being used against localhost.
name to litmus_localhost if the target is localhost, allowing the
helpers to use the mockable entry in the inventory hash.
file if it exists and to substitute the basic localhost inventory
hash if it does not.
the target node is not specified in the inventory hash; previously,
specifying a target not found in the inventory hash could lead to
errors in the actual execution which could be hard to parse.
These changes make it possible to mock features and other inventory
details when executing acceptance tests against a localhost using the
litmus library.