mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
functional-tester/tester: test shuffled cases are equal when sorted
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
9e28331961
commit
6d8d8a6dcb
@ -16,6 +16,7 @@ package tester
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/coreos/etcd/tools/functional-tester/rpcpb"
|
||||
@ -186,4 +187,16 @@ func Test_newCluster(t *testing.T) {
|
||||
if reflect.DeepEqual(fs2, fs3) {
|
||||
t.Fatalf("expected reshuffled failure cases from %q, got %q", fs2, fs3)
|
||||
}
|
||||
|
||||
// shuffle ensures visit all exactly once
|
||||
// so when sorted, failure cases must be equal
|
||||
sort.Strings(fs1)
|
||||
sort.Strings(fs2)
|
||||
sort.Strings(fs3)
|
||||
if !reflect.DeepEqual(fs1, fs2) {
|
||||
t.Fatalf("expected %q, got %q", fs1, fs2)
|
||||
}
|
||||
if !reflect.DeepEqual(fs2, fs3) {
|
||||
t.Fatalf("expected %q, got %q", fs2, fs3)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user