12345678910111213141516171819202122232425262728 |
- // Copyright 2012-present Oliver Eilhard. All rights reserved.
- // Use of this source code is governed by a MIT-license.
- // See http://olivere.mit-license.org/license.txt for details.
- package elastic
- import (
- "context"
- "testing"
- )
- func TestCatHealth(t *testing.T) {
- client := setupTestClientAndCreateIndexAndAddDocs(t, SetDecoder(&strictDecoder{})) // , SetTraceLog(log.New(os.Stdout, "", 0)))
- ctx := context.Background()
- res, err := client.CatHealth().Columns("*").Do(ctx)
- if err != nil {
- t.Fatal(err)
- }
- if res == nil {
- t.Fatal("want response, have nil")
- }
- if len(res) == 0 {
- t.Fatalf("want response, have: %v", res)
- }
- if have := res[0].Cluster; have == "" {
- t.Fatalf("Cluster[0]: want != %q, have %q", "", have)
- }
- }
|