mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
parent
8fa55f5877
commit
9e88c90b28
2 changed files with 11 additions and 0 deletions
|
@ -30,6 +30,9 @@ module LogStash::Util::JavaVersion
|
|||
# The regex below parses this all correctly http://rubular.com/r/sInQc3Nc7f
|
||||
|
||||
match = version_string.match(/\A(\d+)\.(\d+)\.(\d+)(_(\d+))?(-(.+))?\Z/)
|
||||
|
||||
return nil unless match
|
||||
|
||||
major, minor, patch, ufull, update, bfull, build = match.captures
|
||||
|
||||
{
|
||||
|
|
|
@ -31,6 +31,14 @@ describe "LogStash::Util::JavaVersion" do
|
|||
expect(mod.parse_java_version(nil)).to be_nil
|
||||
end
|
||||
|
||||
it "should return nil on non-hotspot javas" do
|
||||
# Not sure this is what is being returned, but it doesn't match the
|
||||
# regex, which is the point
|
||||
expect(mod.parse_java_version("JCL - 20140103_01 based on Oracle 7u51-b11
|
||||
|
||||
")).to be_nil
|
||||
end
|
||||
|
||||
shared_examples("version parsing") do |desc, string, major, minor, patch, update, build|
|
||||
context("#{desc} with version #{string}") do
|
||||
subject(:parsed) { LogStash::Util::JavaVersion.parse_java_version(string) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue