File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -2816,3 +2816,44 @@ func TestPutObjectsLegalholdStatus(t *testing.T) {
28162816 })
28172817 }
28182818}
2819+
2820+ func RestartService () (* http.Response , error ) {
2821+ /*
2822+ Helper function to restart service
2823+ HTTP Verb: POST
2824+ URL: /api/v1/service/restart
2825+ */
2826+ request , err := http .NewRequest (
2827+ "POST" ,
2828+ "http://localhost:9090/api/v1/service/restart" ,
2829+ nil ,
2830+ )
2831+ if err != nil {
2832+ log .Println (err )
2833+ }
2834+ request .Header .Add ("Cookie" , fmt .Sprintf ("token=%s" , token ))
2835+ request .Header .Add ("Content-Type" , "application/json" )
2836+ client := & http.Client {
2837+ Timeout : 2000 * time .Second , // increased timeout since restart takes time, more than other APIs.
2838+ }
2839+ response , err := client .Do (request )
2840+ return response , err
2841+ }
2842+
2843+ func TestRestartService (t * testing.T ) {
2844+ assert := assert .New (t )
2845+ restartResponse , restartError := RestartService ()
2846+ assert .Nil (restartError )
2847+ if restartError != nil {
2848+ log .Println (restartError )
2849+ return
2850+ }
2851+ addObjRsp := inspectHTTPResponse (restartResponse )
2852+ if restartResponse != nil {
2853+ assert .Equal (
2854+ 204 ,
2855+ restartResponse .StatusCode ,
2856+ addObjRsp ,
2857+ )
2858+ }
2859+ }
You can’t perform that action at this time.
0 commit comments