Perform manual failover during the scale down

This commit is contained in:
Murat Kabilov
2017-10-16 17:41:23 +02:00
committed by GitHub
parent 5b29576a8e
commit 6c4cb4e9da
7 changed files with 121 additions and 13 deletions
+21
View File
@@ -46,6 +46,18 @@ var substractTest = []struct {
{[]string{"a", "b", "c", "d"}, []string{"a", "bb", "c", "d"}, []string{"b"}, false},
}
var mapContaintsTest = []struct {
inA map[string]string
inB map[string]string
out bool
}{
{map[string]string{"1": "a", "2": "b", "3": "c", "4": "c"}, map[string]string{"1": "a", "2": "b", "3": "c"}, true},
{map[string]string{"1": "a", "2": "b", "3": "c", "4": "c"}, map[string]string{"1": "a", "2": "b", "3": "d"}, false},
{map[string]string{}, map[string]string{}, true},
{map[string]string{"3": "c", "4": "c"}, map[string]string{"1": "a", "2": "b", "3": "c"}, false},
{map[string]string{"3": "c", "4": "c"}, map[string]string{}, true},
}
var substringMatch = []struct {
inRegex *regexp.Regexp
inStr string
@@ -122,3 +134,12 @@ func TestFindNamedStringSubmatch(t *testing.T) {
}
}
}
func TestMapContains(t *testing.T) {
for _, tt := range mapContaintsTest {
res := MapContains(tt.inA, tt.inB)
if res != tt.out {
t.Errorf("MapContains expected: %#v, got: %#v", tt.out, res)
}
}
}