11package loadtest
22
33import (
4+ "context"
45 "encoding/json"
56 "fmt"
67 "net/http"
78
89 "github.com/castai/cluster-controller/internal/castai"
910)
1011
11- func NewHttpServer (cfg Config , testServer * CastAITestServer ) error {
12-
12+ func NewHttpServer (ctx context.Context , cfg Config , testServer * CastAITestServer ) error {
1313 http .HandleFunc ("/v1/kubernetes/clusters/{cluster_id}/actions" , func (w http.ResponseWriter , r * http.Request ) {
1414 result , err := testServer .GetActions (r .Context (), "" )
1515 if err != nil {
@@ -27,8 +27,6 @@ func NewHttpServer(cfg Config, testServer *CastAITestServer) error {
2727 http .Error (w , err .Error (), http .StatusInternalServerError )
2828 return
2929 }
30-
31- return
3230 })
3331
3432 http .HandleFunc ("/v1/kubernetes/clusters/{cluster_id}/actions/{action_id}/ack" , func (w http.ResponseWriter , r * http.Request ) {
@@ -45,8 +43,6 @@ func NewHttpServer(cfg Config, testServer *CastAITestServer) error {
4543 http .Error (w , err .Error (), http .StatusInternalServerError )
4644 return
4745 }
48-
49- return
5046 })
5147
5248 http .HandleFunc ("/v1/kubernetes/clusters/{cluster_id}/actions/logs" , func (w http.ResponseWriter , r * http.Request ) {
@@ -62,10 +58,8 @@ func NewHttpServer(cfg Config, testServer *CastAITestServer) error {
6258 http .Error (w , err .Error (), http .StatusInternalServerError )
6359 return
6460 }
65-
66- return
6761 })
6862
63+ //nolint:gosec // Missing timeouts are not a real issue here.
6964 return http .ListenAndServe (fmt .Sprintf (":%d" , cfg .Port ), nil )
70-
7165}
0 commit comments