...
1
17
18 package outlierdetection
19
20 import (
21 "reflect"
22 "testing"
23 )
24
25 func TestSuccessRateEjection(t *testing.T) {
26 fields := map[string]bool{
27 "StdevFactor": true,
28 "EnforcementPercentage": true,
29 "MinimumHosts": true,
30 "RequestVolume": true,
31 }
32 typ := reflect.TypeOf(SuccessRateEjection{})
33 for i := 0; i < typ.NumField(); i++ {
34 if n := typ.Field(i).Name; !fields[n] {
35 t.Errorf("New field in SuccessRateEjection %q, update this test and Equal", n)
36 }
37 }
38 }
39
40 func TestEqualFieldsFailurePercentageEjection(t *testing.T) {
41 fields := map[string]bool{
42 "Threshold": true,
43 "EnforcementPercentage": true,
44 "MinimumHosts": true,
45 "RequestVolume": true,
46 }
47 typ := reflect.TypeOf(FailurePercentageEjection{})
48 for i := 0; i < typ.NumField(); i++ {
49 if n := typ.Field(i).Name; !fields[n] {
50 t.Errorf("New field in FailurePercentageEjection %q, update this test and Equal", n)
51 }
52 }
53 }
54
55 func TestEqualFieldsLBConfig(t *testing.T) {
56 fields := map[string]bool{
57 "LoadBalancingConfig": true,
58 "Interval": true,
59 "BaseEjectionTime": true,
60 "MaxEjectionTime": true,
61 "MaxEjectionPercent": true,
62 "SuccessRateEjection": true,
63 "FailurePercentageEjection": true,
64 "ChildPolicy": true,
65 }
66 typ := reflect.TypeOf(LBConfig{})
67 for i := 0; i < typ.NumField(); i++ {
68 if n := typ.Field(i).Name; !fields[n] {
69 t.Errorf("New field in LBConfig %q, update this test and EqualIgnoringChildPolicy", n)
70 }
71 }
72 }
73
View as plain text