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
Fixes #27897 - Parameter type is not required #7054
Fixes #27897 - Parameter type is not required #7054
Conversation
Issues: #27897 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ekohl, I added the test, but when was looking at it in debug I saw that without this change foreman/app/models/parameter.rb Lines 80 to 82 in aabda05
nil not "string" .
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I'd prefer someone with more rails knowledge to give it a look.
@@ -236,6 +236,21 @@ def valid_attrs_with_root(extra_attrs = {}) | |||
assert_equal 42, show_response['parameters'].first['value'].to_i | |||
assert_equal 'integer', show_response['parameters'].first['parameter_type'] | |||
end | |||
|
|||
test "should create a group parameter with default parameter type" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This this test also assert that it was created with the string type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test just asserts that creating doesn't fail if no parameter_type was provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following test does check if there is no parameter type was provided then it defaults to "string"
assert_equal 'string', show_response['parameters'].first['parameter_type'] |
[test foreman] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ofedoren !
As I mentioned in the issue, it causes backward incompatibility (at least in the hammer, but there could be a problem in the custom scripts that use API).