Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions go/test/endtoend/cluster/topo_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,8 @@ func (topo *TopoProcess) IsHealthy() bool {
if err != nil {
return false
}
if resp.StatusCode == 200 {
return true
}
return false
defer resp.Body.Close()
return resp.StatusCode == 200
}

func (topo *TopoProcess) removeTopoDirectories(Cell string) {
Expand All @@ -325,11 +323,17 @@ func (topo *TopoProcess) ManageTopoDir(command string, directory string) (err er
if command == "mkdir" {
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
_, err = http.DefaultClient.Do(req)
resp, err := http.DefaultClient.Do(req)
if err == nil {
defer resp.Body.Close()
}
return err
} else if command == "rmdir" {
req, _ := http.NewRequest("DELETE", url+"?dir=true", payload)
_, err = http.DefaultClient.Do(req)
resp, err := http.DefaultClient.Do(req)
if err == nil {
defer resp.Body.Close()
}
return err
} else {
return nil
Expand Down
6 changes: 2 additions & 4 deletions go/test/endtoend/cluster/vtctld_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ func (vtctld *VtctldProcess) IsHealthy() bool {
if err != nil {
return false
}
if resp.StatusCode == 200 {
return true
}
return false
defer resp.Body.Close()
return resp.StatusCode == 200
}

// TearDown shutdowns the running vtctld service
Expand Down
12 changes: 8 additions & 4 deletions go/test/endtoend/cluster/vtgate_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ func (vtgate *VtgateProcess) WaitForStatus() bool {
if err != nil {
return false
}
if resp.StatusCode == 200 {
return true
}
return false
defer resp.Body.Close()

return resp.StatusCode == 200
}

// GetStatusForTabletOfShard function gets status for a specific tablet of a shard in keyspace
Expand All @@ -177,6 +176,8 @@ func (vtgate *VtgateProcess) GetStatusForTabletOfShard(name string, endPointsCou
if err != nil {
return false
}
defer resp.Body.Close()

if resp.StatusCode == 200 {
resultMap := make(map[string]any)
respByte, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -286,6 +287,8 @@ func (vtgate *VtgateProcess) GetVars() (map[string]any, error) {
if err != nil {
return nil, fmt.Errorf("error getting response from %s", vtgate.VerifyURL)
}
defer resp.Body.Close()

if resp.StatusCode == 200 {
respByte, _ := io.ReadAll(resp.Body)
err := json.Unmarshal(respByte, &resultMap)
Expand All @@ -305,6 +308,7 @@ func (vtgate *VtgateProcess) ReadVSchema() (*interface{}, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()
res, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
Expand Down
6 changes: 5 additions & 1 deletion go/test/endtoend/cluster/vttablet_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ func (vttablet *VttabletProcess) GetStatus() string {
if err != nil {
return ""
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
respByte, _ := io.ReadAll(resp.Body)
defer resp.Body.Close()
return string(respByte)
}
return ""
Expand All @@ -178,6 +178,8 @@ func (vttablet *VttabletProcess) GetVars() map[string]any {
if err != nil {
return nil
}
defer resp.Body.Close()

if resp.StatusCode == 200 {
resultMap := make(map[string]any)
respByte, _ := io.ReadAll(resp.Body)
Expand All @@ -196,6 +198,8 @@ func (vttablet *VttabletProcess) GetStatusDetails() string {
if err != nil {
return fmt.Sprintf("Status details failed: %v", err.Error())
}
defer resp.Body.Close()

respByte, _ := io.ReadAll(resp.Body)
return string(respByte)
}
Expand Down