diff --git a/apps/glusterfs/app_node.go b/apps/glusterfs/app_node.go index e27846b454..c62bc018de 100644 --- a/apps/glusterfs/app_node.go +++ b/apps/glusterfs/app_node.go @@ -181,9 +181,10 @@ func (a *App) NodeDelete(w http.ResponseWriter, r *http.Request) { return } - // Show that the key has been deleted - logger.Info("Deleted node [%s]", id) - - // Write msg - w.WriteHeader(http.StatusOK) + a.asyncManager.AsyncHttpRedirectFunc(w, r, func() (string, error) { + time.Sleep(1 * time.Second) + // Show that the key has been deleted + logger.Info("Deleted node [%s]", id) + return "", nil + }) } diff --git a/apps/glusterfs/app_node_test.go b/apps/glusterfs/app_node_test.go index a0a0c258a3..b3e057a116 100644 --- a/apps/glusterfs/app_node_test.go +++ b/apps/glusterfs/app_node_test.go @@ -272,7 +272,23 @@ func TestNodeAddDelete(t *testing.T) { tests.Assert(t, err == nil) r, err = http.DefaultClient.Do(req) tests.Assert(t, err == nil) - tests.Assert(t, r.StatusCode == http.StatusOK) + tests.Assert(t, r.StatusCode == http.StatusAccepted) + location, err = r.Location() + tests.Assert(t, err == nil) + + // Wait for deletion + for { + r, err := http.Get(location.String()) + tests.Assert(t, err == nil) + if r.Header.Get("X-Pending") == "true" { + tests.Assert(t, r.StatusCode == http.StatusOK) + time.Sleep(time.Millisecond * 10) + continue + } else { + tests.Assert(t, r.StatusCode == http.StatusNoContent) + break + } + } // Check db to make sure key is removed err = app.db.View(func(tx *bolt.Tx) error {