git.iko.soy/typeable/bloodhound
on master help sign in
add test for deleting alias
commit6e8081751bd1aaed3a4dccaee659e8fb1b1b4d04 authorAndrew Martin <andrew.thaddeus@gmail.com> dateWed 23 Aug 2017, 16:01 (9 years ago) parentdc1e450
1 file changed+16−4
tests/V5/tests.hs+16−4
tests/V5/tests.hs+16−4
@@ -1551,11 +1551,11 @@ main = hspec $ do
15511551 scan_search `shouldMatchList` [Just exampleTweet, Just otherTweet]
15521552
15531553 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
15541558 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−
15591559 withTestEnv $ do
15601560 resetIndex
15611561 resp <- updateIndexAliases (action :| [])
@@ -1567,6 +1567,18 @@ main = hspec $ do
15671567 Right (IndexAliasesSummary summs) ->
15681568 L.find ((== alias) . indexAliasSummaryAlias) summs `shouldBe` Just expected
15691569 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)
15701582
15711583 describe "Index Listing" $ do
15721584 it "returns a list of index names" $ withTestEnv $ do