From 181fbcc9b970dbc3a071380f266710e2b629f123 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 13 Jun 2018 11:54:27 +0100 Subject: [PATCH] agent: intention update/delete responess match ACL/KV behavior --- agent/intentions_endpoint.go | 5 +++-- agent/intentions_endpoint_test.go | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/agent/intentions_endpoint.go b/agent/intentions_endpoint.go index 8a482f08a2..642c7da7b2 100644 --- a/agent/intentions_endpoint.go +++ b/agent/intentions_endpoint.go @@ -248,7 +248,8 @@ func (s *HTTPServer) IntentionSpecificUpdate(id string, resp http.ResponseWriter return nil, err } - return nil, nil + // Update uses the same create response + return intentionCreateResponse{reply}, nil } @@ -268,7 +269,7 @@ func (s *HTTPServer) IntentionSpecificDelete(id string, resp http.ResponseWriter return nil, err } - return nil, nil + return true, nil } // intentionCreateResponse is the response structure for creating an intention. diff --git a/agent/intentions_endpoint_test.go b/agent/intentions_endpoint_test.go index 00263a14e8..a084edacc2 100644 --- a/agent/intentions_endpoint_test.go +++ b/agent/intentions_endpoint_test.go @@ -380,7 +380,9 @@ func TestIntentionsSpecificUpdate_good(t *testing.T) { resp := httptest.NewRecorder() obj, err := a.srv.IntentionSpecific(resp, req) assert.Nil(err) - assert.Nil(obj) + + value := obj.(intentionCreateResponse) + assert.Equal(reply, value.ID) // Read the value { @@ -436,7 +438,7 @@ func TestIntentionsSpecificDelete_good(t *testing.T) { resp := httptest.NewRecorder() obj, err := a.srv.IntentionSpecific(resp, req) assert.Nil(err) - assert.Nil(obj) + assert.Equal(true, obj) // Verify the intention is gone {