git.iko.soy/typeable/bloodhound
on master help sign in
add test for deleting alias
6e80817Andrew Martin
tests/V5/tests.hs+16−4
@@ -1551,11 +1551,11 @@ main = hspec $ do
1551 scan_search `shouldMatchList` [Just exampleTweet, Just otherTweet]
1551 scan_search `shouldMatchList` [Just exampleTweet, Just otherTweet]
1552
1552
1553 describe "index aliases" $ do
1553 describe "index aliases" $ do
1554+ let aname = IndexAliasName (IndexName "bloodhound-tests-twitter-1-alias")
1555+ let alias = IndexAlias (testIndex) aname
1556+ let create = IndexAliasCreate Nothing Nothing
1557+ let action = AddAlias alias create
1554 it "handles the simple case of aliasing an existing index" $ do
1558 it "handles the simple case of aliasing an existing index" $ do
1555− let alias = IndexAlias (testIndex) (IndexAliasName (IndexName "bloodhound-tests-twitter-1-alias"))
1556− let create = IndexAliasCreate Nothing Nothing
1557− let action = AddAlias alias create
1558−
1559 withTestEnv $ do
1559 withTestEnv $ do
1560 resetIndex
1560 resetIndex
1561 resp <- updateIndexAliases (action :| [])
1561 resp <- updateIndexAliases (action :| [])
@@ -1567,6 +1567,18 @@ main = hspec $ do
1567 Right (IndexAliasesSummary summs) ->
1567 Right (IndexAliasesSummary summs) ->
1568 L.find ((== alias) . indexAliasSummaryAlias) summs `shouldBe` Just expected
1568 L.find ((== alias) . indexAliasSummaryAlias) summs `shouldBe` Just expected
1569 Left e -> expectationFailure ("Expected an IndexAliasesSummary but got " <> show e)) `finally` cleanup
1569 Left e -> expectationFailure ("Expected an IndexAliasesSummary but got " <> show e)) `finally` cleanup
1570+ it "allows alias deletion" $ do
1571+ aliases <- withTestEnv $ do
1572+ resetIndex
1573+ resp <- updateIndexAliases (action :| [])
1574+ liftIO $ validateStatus resp 200
1575+ deleteIndexAlias aname
1576+ getIndexAliases
1577+ let expected = IndexAliasSummary alias create
1578+ case aliases of
1579+ Right (IndexAliasesSummary summs) ->
1580+ L.find ((== aname) . indexAlias . indexAliasSummaryAlias) summs `shouldBe` Nothing
1581+ Left e -> expectationFailure ("Expected an IndexAliasesSummary but got " <> show e)
1570
1582
1571 describe "Index Listing" $ do
1583 describe "Index Listing" $ do
1572 it "returns a list of index names" $ withTestEnv $ do
1584 it "returns a list of index names" $ withTestEnv $ do