Loosen IndexAliasesSummary

Looks like 1.4.1 produces different outputs (namely an empty object
instead of {aliases: null}), even though 1.4.5 does the right
thing. This should hopefully clear up the one sticking case in the
travis build.
This commit is contained in:
Michael Xavier 2015-11-18 16:12:55 -08:00
parent 8a8492dfdd
commit 10666e6b17
2 changed files with 3 additions and 3 deletions

View File

@ -3069,7 +3069,7 @@ instance FromJSON IndexAliasesSummary where
parseJSON = withObject "IndexAliasesSummary" parse
where parse o = IndexAliasesSummary . mconcat <$> mapM (uncurry go) (HM.toList o)
go ixn = withObject "index aliases" $ \ia -> do
aliases <- ia .: "aliases"
aliases <- ia .:? "aliases" .!= mempty
forM (HM.toList aliases) $ \(aName, v) -> do
let indexAlias = IndexAlias (IndexName ixn) (IndexAliasName (IndexName aName))
IndexAliasSummary indexAlias <$> parseJSON v

View File

@ -1350,7 +1350,7 @@ main = hspec $ do
withTestEnv $ do
resetIndex
resp <- updateIndexAliases (action :| [])
liftIO $ NHTS.statusCode (responseStatus resp) `shouldBe` 200
liftIO $ validateStatus resp 200
let cleanup = withTestEnv (updateIndexAliases (RemoveAlias alias :| []))
(do aliases <- withTestEnv getIndexAliases
let expected = IndexAliasSummary alias create
@ -1371,7 +1371,7 @@ main = hspec $ do
withTestEnv $ do
resetIndex
resp <- updateIndexAliases (action :| [])
liftIO $ NHTS.statusCode (responseStatus resp) `shouldBe` 200
liftIO $ validateStatus resp 200
let cleanup = withTestEnv (updateIndexAliases (RemoveAlias alias :| []))
(do aliases <- withTestEnv getIndexAliases
let expected = IndexAliasSummary alias create