Make sure we delete those test indexes, even on failure
This commit is contained in:
parent
782ceb74a5
commit
167e20d669
@ -163,6 +163,7 @@ func (s *GoesTestSuite) TestDeleteIndexExistingIndex(c *C) {
|
|||||||
indexName := "testdeleteindexexistingindex"
|
indexName := "testdeleteindexexistingindex"
|
||||||
|
|
||||||
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
||||||
|
defer conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
@ -181,8 +182,12 @@ func (s *GoesTestSuite) TestUpdateIndexSettings(c *C) {
|
|||||||
conn := NewClient(ESHost, ESPort)
|
conn := NewClient(ESHost, ESPort)
|
||||||
indexName := "testupdateindex"
|
indexName := "testupdateindex"
|
||||||
|
|
||||||
|
// Just in case
|
||||||
|
conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
defer conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
_, err = conn.UpdateIndexSettings(indexName, map[string]interface{}{
|
_, err = conn.UpdateIndexSettings(indexName, map[string]interface{}{
|
||||||
"index": map[string]interface{}{
|
"index": map[string]interface{}{
|
||||||
@ -201,6 +206,7 @@ func (s *GoesTestSuite) TestRefreshIndex(c *C) {
|
|||||||
|
|
||||||
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
defer conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
_, err = conn.RefreshIndex(indexName)
|
_, err = conn.RefreshIndex(indexName)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
@ -216,6 +222,7 @@ func (s *GoesTestSuite) TestOptimize(c *C) {
|
|||||||
conn.DeleteIndex(indexName)
|
conn.DeleteIndex(indexName)
|
||||||
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
defer conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
// we must wait for a bit otherwise ES crashes
|
// we must wait for a bit otherwise ES crashes
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
@ -262,6 +269,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
|
|||||||
conn.DeleteIndex(indexName)
|
conn.DeleteIndex(indexName)
|
||||||
_, err := conn.CreateIndex(indexName, nil)
|
_, err := conn.CreateIndex(indexName, nil)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
defer conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
response, err := conn.BulkSend(tweets)
|
response, err := conn.BulkSend(tweets)
|
||||||
i := Item{
|
i := Item{
|
||||||
@ -352,6 +360,7 @@ func (s *GoesTestSuite) TestStats(c *C) {
|
|||||||
conn.DeleteIndex(indexName)
|
conn.DeleteIndex(indexName)
|
||||||
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
defer conn.DeleteIndex(indexName)
|
||||||
|
|
||||||
// we must wait for a bit otherwise ES crashes
|
// we must wait for a bit otherwise ES crashes
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
Loading…
Reference in New Issue
Block a user