open-nomad/command/agent/system_endpoint_test.go
2016-08-03 16:12:47 -07:00

45 lines
998 B
Go

package agent
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestHTTP_SystemGarbageCollect(t *testing.T) {
httpTest(t, nil, func(s *TestServer) {
// Make the HTTP request
req, err := http.NewRequest("PUT", "/v1/system/gc", nil)
if err != nil {
t.Fatalf("err: %v", err)
}
respW := httptest.NewRecorder()
// Make the request
if _, err := s.Server.GarbageCollectRequest(respW, req); err != nil {
t.Fatalf("err: %v", err)
}
})
}
func TestHTTP_ReconcileJobSummaries(t *testing.T) {
httpTest(t, nil, func(s *TestServer) {
// Make the HTTP request
req, err := http.NewRequest("PUT", "/v1/system/reconcilesummaries", nil)
if err != nil {
t.Fatalf("err: %v", err)
}
respW := httptest.NewRecorder()
// Make the request
if _, err := s.Server.ReconcileJobSummaries(respW, req); err != nil {
t.Fatalf("err: %v", err)
}
t.Fatalf("code %v", respW.Code)
if respW.Code != 200 {
t.Fatalf("expected: %v, actual: %v", 200, respW.Code)
}
})
}