github.com/rohankumardubey/nomad@v0.11.8/command/agent/system_endpoint_test.go (about) 1 package agent 2 3 import ( 4 "net/http" 5 "net/http/httptest" 6 "testing" 7 ) 8 9 func TestHTTP_SystemGarbageCollect(t *testing.T) { 10 t.Parallel() 11 httpTest(t, nil, func(s *TestAgent) { 12 // Make the HTTP request 13 req, err := http.NewRequest("PUT", "/v1/system/gc", nil) 14 if err != nil { 15 t.Fatalf("err: %v", err) 16 } 17 respW := httptest.NewRecorder() 18 19 // Make the request 20 if _, err := s.Server.GarbageCollectRequest(respW, req); err != nil { 21 t.Fatalf("err: %v", err) 22 } 23 }) 24 } 25 26 func TestHTTP_ReconcileJobSummaries(t *testing.T) { 27 t.Parallel() 28 httpTest(t, nil, func(s *TestAgent) { 29 // Make the HTTP request 30 req, err := http.NewRequest("PUT", "/v1/system/reconcile/summaries", nil) 31 if err != nil { 32 t.Fatalf("err: %v", err) 33 } 34 respW := httptest.NewRecorder() 35 36 // Make the request 37 if _, err := s.Server.ReconcileJobSummaries(respW, req); err != nil { 38 t.Fatalf("err: %v", err) 39 } 40 41 if respW.Code != 200 { 42 t.Fatalf("expected: %v, actual: %v", 200, respW.Code) 43 } 44 }) 45 }