indices_shrink_test.go 766 B

12345678910111213141516171819202122232425262728293031323334
  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 "testing"
  6. func TestIndicesShrinkBuildURL(t *testing.T) {
  7. client := setupTestClient(t)
  8. tests := []struct {
  9. Source string
  10. Target string
  11. Expected string
  12. }{
  13. {
  14. "my_source_index",
  15. "my_target_index",
  16. "/my_source_index/_shrink/my_target_index",
  17. },
  18. }
  19. for i, test := range tests {
  20. path, _, err := client.ShrinkIndex(test.Source, test.Target).buildURL()
  21. if err != nil {
  22. t.Errorf("case #%d: %v", i+1, err)
  23. continue
  24. }
  25. if path != test.Expected {
  26. t.Errorf("case #%d: expected %q; got: %q", i+1, test.Expected, path)
  27. }
  28. }
  29. }