diff --git a/.travis.yml b/.travis.yml index 1df3c80..15eb87a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,6 @@ env: global: - JAVA_HOME=/usr/lib/jvm/java-8-oracle matrix: - - GHCVER=7.8 ESVER=1.3.6 STACK_YAML=stack-7.8.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch - - GHCVER=7.8 ESVER=1.4.1 STACK_YAML=stack-7.8.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch - - GHCVER=7.10 ESVER=1.5.2 STACK_YAML=stack-7.10.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch - - GHCVER=7.10 ESVER=1.6.0 STACK_YAML=stack-7.10.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch - - GHCVER=7.10 ESVER=1.7.6 STACK_YAML=stack-7.10.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch - GHCVER=8.0 ESVER=1.7.6 STACK_YAML=stack-8.0.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch - GHCVER=8.0 ESVER=5.0.2 STACK_YAML=stack-8.0.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m" - GHCVER=8.2 ESVER=1.7.6 STACK_YAML=stack.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch diff --git a/src/Bloodhound/Import.hs b/src/Bloodhound/Import.hs index 4af8fb7..9363b5e 100644 --- a/src/Bloodhound/Import.hs +++ b/src/Bloodhound/Import.hs @@ -9,6 +9,7 @@ module Bloodhound.Import , showText , deleteSeveral , oPath + , tshow ) where import Control.Applicative as X (Alternative (..), optional) diff --git a/src/Database/V5/Bloodhound/Internal/Client.hs b/src/Database/V5/Bloodhound/Internal/Client.hs index 417359e..883e1ae 100644 --- a/src/Database/V5/Bloodhound/Internal/Client.hs +++ b/src/Database/V5/Bloodhound/Internal/Client.hs @@ -1418,15 +1418,20 @@ data NodeJVMInfo = NodeJVMInfo { , nodeJVMInfoMemoryInfo :: JVMMemoryInfo , nodeJVMInfoStartTime :: UTCTime , nodeJVMInfoVMVendor :: Text - , nodeJVMVMVersion :: VersionNumber + , nodeJVMVMVersion :: VMVersion -- ^ JVM doesn't seme to follow normal version conventions , nodeJVMVMName :: Text - , nodeJVMVersion :: VersionNumber + , nodeJVMVersion :: JVMVersion , nodeJVMPID :: PID } deriving (Eq, Show) --- | Handles quirks in the way JVM versions are rendered (1.7.0_101 -> 1.7.0.101) -newtype JVMVersion = JVMVersion { unJVMVersion :: VersionNumber } +-- | We cannot parse JVM version numbers and we're not going to try. +newtype JVMVersion = + JVMVersion { unJVMVersion :: Text } + deriving (Eq, Show) + +instance FromJSON JVMVersion where + parseJSON = withText "JVMVersion" (pure . JVMVersion) data JVMMemoryInfo = JVMMemoryInfo { jvmMemoryInfoDirectMax :: Bytes @@ -1436,6 +1441,18 @@ data JVMMemoryInfo = JVMMemoryInfo { , jvmMemoryInfoHeapInit :: Bytes } deriving (Eq, Show) +-- VM version numbers don't appear to be SemVer +-- so we're special casing this jawn. +newtype VMVersion = + VMVersion { unVMVersion :: Text } + deriving (Eq, Show) + +instance ToJSON VMVersion where + toJSON = toJSON . unVMVersion + +instance FromJSON VMVersion where + parseJSON = withText "VMVersion" (pure . VMVersion) + newtype JVMMemoryPool = JVMMemoryPool { jvmMemoryPool :: Text } deriving (Eq, Show, FromJSON) @@ -2228,14 +2245,9 @@ instance FromJSON NodeJVMInfo where <*> o .: "vm_vendor" <*> o .: "vm_version" <*> o .: "vm_name" - <*> (unJVMVersion <$> o .: "version") + <*> o .: "version" <*> o .: "pid" -instance FromJSON JVMVersion where - parseJSON (String t) = - JVMVersion <$> parseJSON (String (T.replace "_" "." t)) - parseJSON v = JVMVersion <$> parseJSON v - instance FromJSON JVMMemoryInfo where parseJSON = withObject "JVMMemoryInfo" parse where diff --git a/stack-7.10.yaml b/stack-7.10.yaml deleted file mode 100644 index d1b418e..0000000 --- a/stack-7.10.yaml +++ /dev/null @@ -1,21 +0,0 @@ -flags: - bloodhound-examples: - werror: true -packages: -- '.' -- './examples' -extra-deps: -- http-client-0.5.0 -- aeson-1.2.0.0 -- fail-4.9.0.0 -- http-types-0.9 -- attoparsec-0.13.0.1 -- quickcheck-properties-0.1 -- semigroups-0.18.3 -- uri-bytestring-0.1.9 -- temporary-resourcet-0.1.0.0 -- transformers-compat-0.5.1.4 -- pretty-simple-2.0.2.0 -- quickcheck-arbitrary-template-0.2.0.0 - -resolver: lts-6.12 diff --git a/stack-7.8.yaml b/stack-7.8.yaml deleted file mode 100644 index af7834f..0000000 --- a/stack-7.8.yaml +++ /dev/null @@ -1,25 +0,0 @@ -flags: - aeson: - old-locale: true - bloodhound-examples: - werror: true -packages: -- '.' -- './examples' -extra-deps: -- aeson-0.11.1.0 -- fail-4.9.0.0 -- http-types-0.9 -- http-client-0.5.0 -- attoparsec-0.13.0.1 -- quickcheck-properties-0.1 -- semigroups-0.18.0.1 -- tagged-0.8.3 -- uri-bytestring-0.1.9 -- void-0.7.1 -- generics-sop-0.2.2.0 -- unordered-containers-0.2.6.0 -- pretty-simple-2.0.2.0 -- quickcheck-arbitrary-template-0.2.0.0 - -resolver: lts-2.18 diff --git a/tests/V5/Test/Generators.hs b/tests/V5/Test/Generators.hs index 1f80b76..facf42d 100644 --- a/tests/V5/Test/Generators.hs +++ b/tests/V5/Test/Generators.hs @@ -462,9 +462,6 @@ makeArbitrary ''Analysis instance Arbitrary Analysis where arbitrary = arbitraryAnalysis makeArbitrary ''Tokenizer instance Arbitrary Tokenizer where arbitrary = arbitraryTokenizer -makeArbitrary ''UpdatableIndexSetting -instance Arbitrary UpdatableIndexSetting where - arbitrary = arbitraryUpdatableIndexSetting makeArbitrary ''Compression instance Arbitrary Compression where arbitrary = arbitraryCompression makeArbitrary ''Bytes @@ -534,6 +531,10 @@ instance Arbitrary FactorMissingFieldValue where arbitrary = arbitraryFactorMiss makeArbitrary ''FactorModifier instance Arbitrary FactorModifier where arbitrary = arbitraryFactorModifier +makeArbitrary ''UpdatableIndexSetting +instance Arbitrary UpdatableIndexSetting where + arbitrary = resize 10 arbitraryUpdatableIndexSetting + newtype UpdatableIndexSetting' = UpdatableIndexSetting' UpdatableIndexSetting deriving (Show, Eq, ToJSON, FromJSON, ApproxEq, Typeable)