-
Notifications
You must be signed in to change notification settings - Fork 18
CI: Adjust error matching for newer json gem / newer JRuby #161
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
it 'raises an error if JSON is invalid' do | ||
expect { | ||
Puppet::Util::Json.load('{ invalid') | ||
}.to raise_error(Puppet::Util::Json::ParseError, /expected object key, got 'invalid' at line 1 column 3/) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also looks like an error from the json lib:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hahaha. While digging around I found ruby/json#754, which I raised some months ago. From the developers:
Still it would be nice to figure out it this passes with an older json gem version. |
||
}.to raise_error(Puppet::Util::Json::ParseError) | ||
end | ||
|
||
it 'raises an error if the content is empty' do | ||
|
@@ -74,7 +74,7 @@ | |
it 'returns nil when the file is invalid JSON and debug logs about it' do | ||
file_path = file_containing('input', '{ invalid') | ||
expect(Puppet).to receive(:debug) | ||
.with(/Could not retrieve JSON content .+: expected object key, got 'invalid' at line 1 column 3/).and_call_original | ||
.with(/Could not retrieve JSON content/).and_call_original | ||
|
||
expect(Puppet::Util::Json.load_file_if_valid(file_path)).to eql(nil) | ||
end | ||
|
@@ -102,7 +102,7 @@ | |
|
||
expect { | ||
Puppet::Util::Json.load_file(file_path) | ||
}.to raise_error(Puppet::Util::Json::ParseError, /expected object key, got 'invalid' at line 1 column 3/) | ||
}.to raise_error(Puppet::Util::Json::ParseError) | ||
end | ||
|
||
it 'raises an error when the filename is illegal' 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.
I don't know yet what would have raised
"\\xE2" from ASCII-8BIT to UTF-8
.partial character in source, but hit end
should come from the json gem java version: https://github.com/ruby/json/blob/master/java/src/json/ext/StringDecoder.java#L168-L176.Maybe that exception just isn't raised anymore 🤔