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