55 "errors"
66 "fmt"
77 "io/ioutil"
8+ "math"
89 "net/http"
910 "reflect"
1011 "testing"
@@ -15,7 +16,6 @@ import (
1516
1617 acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
1718 v1 "k8s.io/api/core/v1"
18- "k8s.io/apimachinery/pkg/util/intstr"
1919)
2020
2121var logger = logrus .New ().WithField ("test" , "patroni" )
@@ -101,16 +101,27 @@ func TestGetClusterMembers(t *testing.T) {
101101 Role : "sync_standby" ,
102102 State : "running" ,
103103 Timeline : 1 ,
104- Lag : intstr. IntOrString { IntVal : 0 } ,
104+ Lag : 0 ,
105105 }, {
106106 Name : "acid-test-cluster-2" ,
107107 Role : "replica" ,
108108 State : "running" ,
109109 Timeline : 1 ,
110- Lag : intstr.IntOrString {Type : 1 , StrVal : "unknown" },
110+ Lag : math .MaxUint64 ,
111+ }, {
112+ Name : "acid-test-cluster-3" ,
113+ Role : "replica" ,
114+ State : "running" ,
115+ Timeline : 1 ,
116+ Lag : 3000000000 ,
111117 }}
112118
113- json := `{"members": [{"name": "acid-test-cluster-0", "role": "leader", "state": "running", "api_url": "http://192.168.100.1:8008/patroni", "host": "192.168.100.1", "port": 5432, "timeline": 1}, {"name": "acid-test-cluster-1", "role": "sync_standby", "state": "running", "api_url": "http://192.168.100.2:8008/patroni", "host": "192.168.100.2", "port": 5432, "timeline": 1, "lag": 0}, {"name": "acid-test-cluster-2", "role": "replica", "state": "running", "api_url": "http://192.168.100.3:8008/patroni", "host": "192.168.100.3", "port": 5432, "timeline": 1, "lag": "unknown"}]}`
119+ json := `{"members": [
120+ {"name": "acid-test-cluster-0", "role": "leader", "state": "running", "api_url": "http://192.168.100.1:8008/patroni", "host": "192.168.100.1", "port": 5432, "timeline": 1},
121+ {"name": "acid-test-cluster-1", "role": "sync_standby", "state": "running", "api_url": "http://192.168.100.2:8008/patroni", "host": "192.168.100.2", "port": 5432, "timeline": 1, "lag": 0},
122+ {"name": "acid-test-cluster-2", "role": "replica", "state": "running", "api_url": "http://192.168.100.3:8008/patroni", "host": "192.168.100.3", "port": 5432, "timeline": 1, "lag": "unknown"},
123+ {"name": "acid-test-cluster-3", "role": "replica", "state": "running", "api_url": "http://192.168.100.3:8008/patroni", "host": "192.168.100.3", "port": 5432, "timeline": 1, "lag": 3000000000}
124+ ]}`
114125 r := ioutil .NopCloser (bytes .NewReader ([]byte (json )))
115126
116127 response := http.Response {
0 commit comments