indices_exists_test.go 582 B

1234567891011121314151617181920212223
  1. // Copyright 2012-present Oliver Eilhard. All rights reserved.
  2. // Use of this source code is governed by a MIT-license.
  3. // See http://olivere.mit-license.org/license.txt for details.
  4. package elastic
  5. import (
  6. "context"
  7. "testing"
  8. )
  9. func TestIndicesExistsWithoutIndex(t *testing.T) {
  10. client := setupTestClient(t)
  11. // No index name -> fail with error
  12. res, err := NewIndicesExistsService(client).Do(context.TODO())
  13. if err == nil {
  14. t.Fatalf("expected IndicesExists to fail without index name")
  15. }
  16. if res != false {
  17. t.Fatalf("expected result to be false; got: %v", res)
  18. }
  19. }