mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 04:47:53 +00:00
Merge pull request #1435 from molecula/fix-node-removal-error
Clarify node removal error when self-removing
This commit is contained in:
commit
8647b80adb
2 changed files with 3 additions and 3 deletions
2
api.go
2
api.go
|
|
@ -1775,7 +1775,7 @@ func (api *API) RemoveNode(id string) (*topology.Node, error) {
|
|||
}
|
||||
|
||||
if api.cluster.disCo.ID() == id {
|
||||
return nil, errors.Wrapf(ErrPreconditionFailed, "the node %s can not be removed", id)
|
||||
return nil, errors.Wrapf(ErrPreconditionFailed, "cannot issue node removal request to the node being removed, id=%s", id)
|
||||
}
|
||||
|
||||
removeNode := api.cluster.nodeByID(id)
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ func TestClusterResize_RemoveNode(t *testing.T) {
|
|||
nodeID := mustNodeID(coord.URL())
|
||||
resp := test.Do(t, "POST", coord.URL()+"/cluster/resize/remove-node", fmt.Sprintf(`{"id": "%s"}`, nodeID))
|
||||
|
||||
expBody := fmt.Sprintf("removing node: the node %s can not be removed: precondition failed", nodeID)
|
||||
expBody := fmt.Sprintf("removing node: cannot issue node removal request to the node being removed, id=%s: precondition failed", nodeID)
|
||||
if resp.StatusCode != http.StatusInternalServerError {
|
||||
t.Fatalf("expected StatusCode %d but got %d", http.StatusInternalServerError, resp.StatusCode)
|
||||
} else if strings.TrimSpace(resp.Body) != expBody {
|
||||
|
|
@ -600,7 +600,7 @@ func TestClusterResize_RemoveNode(t *testing.T) {
|
|||
nodeID := mustNodeID(other.URL())
|
||||
resp := test.Do(t, "POST", other.URL()+"/cluster/resize/remove-node", fmt.Sprintf(`{"id": "%s"}`, nodeID))
|
||||
|
||||
expBody := fmt.Sprintf("removing node: the node %s can not be removed: precondition failed", nodeID)
|
||||
expBody := fmt.Sprintf(`removing node: cannot issue node removal request to the node being removed, id=%s: precondition failed`, nodeID)
|
||||
if resp.StatusCode != http.StatusInternalServerError {
|
||||
t.Fatalf("expected StatusCode %d but got %d", http.StatusInternalServerError, resp.StatusCode)
|
||||
} else if strings.TrimSpace(resp.Body) != expBody {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue