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 TestCatCount(t *testing.T) {
- client := setupTestClientAndCreateIndexAndAddDocs(t, SetDecoder(&strictDecoder{})) // , SetTraceLog(log.New(os.Stdout, "", 0)))
- ctx := context.Background()
- res, err := client.CatCount().Pretty(true).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].Count; have <= 0 {
- t.Fatalf("Count[0]: want > %d, have %d", 0, have)
- }
- }
|