From e42ce28ae769fcbb324bec5f1f8be85331dadb4d Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Tue, 20 Dec 2016 14:27:38 -0800 Subject: [PATCH] Added two tests --- command/agent/alloc_endpoint_test.go | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/command/agent/alloc_endpoint_test.go b/command/agent/alloc_endpoint_test.go index f996799b7..ad32aa39e 100644 --- a/command/agent/alloc_endpoint_test.go +++ b/command/agent/alloc_endpoint_test.go @@ -194,3 +194,38 @@ func TestHTTP_AllocSnapshot(t *testing.T) { } }) } + +func TestHTTP_AllocGC(t *testing.T) { + httpTest(t, nil, func(s *TestServer) { + // Make the HTTP request + req, err := http.NewRequest("GET", "/v1/client/allocation/123/gc", nil) + if err != nil { + t.Fatalf("err: %v", err) + } + respW := httptest.NewRecorder() + + // Make the request + _, err = s.Server.ClientAllocRequest(respW, req) + if !strings.Contains(err.Error(), "unable to collect allocation") { + t.Fatalf("err: %v", err) + } + }) +} + +func TestHTTP_AllocAllGC(t *testing.T) { + httpTest(t, nil, func(s *TestServer) { + // Make the HTTP request + req, err := http.NewRequest("GET", "/v1/client/gc", nil) + if err != nil { + t.Fatalf("err: %v", err) + } + respW := httptest.NewRecorder() + + // Make the request + _, err = s.Server.ClientGCRequest(respW, req) + if err != nil { + t.Fatalf("err: %v", err) + } + }) + +}