Adding more patroni fields. Added example result.

This commit is contained in:
Jan Mußler 2021-02-22 23:48:27 +01:00
parent 57af48d525
commit 3e0a5d03a9
2 changed files with 10 additions and 6 deletions

View File

@ -73,7 +73,9 @@ func (p *Patroni) httpPostOrPatch(method string, url string, body *bytes.Buffer)
return fmt.Errorf("could not create request: %v", err)
}
if p.logger != nil {
p.logger.Debugf("making %s http request: %s", method, request.URL.String())
}
resp, err := p.httpClient.Do(request)
if err != nil {
@ -142,6 +144,8 @@ type MemberData struct {
State string `json:"state"`
Role string `json:"role"`
ServerVersion int `json:"server_version"`
PendingRestart string `json:"pending_restart"`
ClusterUnlocked bool `json:"cluster_unlocked"`
Patroni MemberDataPatroni `json:"patroni"`
}

View File

@ -84,7 +84,7 @@ func TestPatroniAPI(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
json := `{"name":"Test Name","full_name":"test full name","owner":{"login": "octocat"}}`
json := `{"state": "running", "postmaster_start_time": "2021-02-19 14:31:50.053 CET", "role": "master", "server_version": 90621, "cluster_unlocked": false, "xlog": {"location": 55978296057856}, "timeline": 6, "database_system_identifier": "6462555844314089962", "pending_restart": true, "patroni": {"version": "2.0.1", "scope": "acid-rest92-standby"}}`
r := ioutil.NopCloser(bytes.NewReader([]byte(json)))
response := http.Response{