func testRenewLock(s *server.Server, key string, index string, value string, ttl int) (string, int, error) { resp, err := tests.PutForm(fmt.Sprintf("%s/mod/v2/lock/%s?index=%s&value=%s&ttl=%d", s.URL(), key, index, value, ttl), nil) ret := tests.ReadBody(resp) return string(ret), resp.StatusCode, err }
func testReleaseLock(s *server.Server, key string, index string, value string) (string, int, error) { resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/v2/lock/%s?index=%s&value=%s", s.URL(), key, index, value), nil) ret := tests.ReadBody(resp) return string(ret), resp.StatusCode, err }
func testDeleteLeader(s *server.Server, key string, name string) (string, int, error) { resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/v2/leader/%s?name=%s", s.URL(), key, name), nil) ret := tests.ReadBody(resp) return string(ret), resp.StatusCode, err }
func testGetLockValue(s *server.Server, key string) (string, int, error) { resp, err := tests.Get(fmt.Sprintf("%s/mod/v2/lock/%s", s.URL(), key)) ret := tests.ReadBody(resp) return string(ret), resp.StatusCode, err }
func testSetLeader(s *server.Server, key string, name string, ttl int) (string, int, error) { resp, err := tests.PutForm(fmt.Sprintf("%s/mod/v2/leader/%s?name=%s&ttl=%d", s.URL(), key, name, ttl), nil) ret := tests.ReadBody(resp) return string(ret), resp.StatusCode, err }