diff --git a/Makefile b/Makefile index 31a66a9..58b7904 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ proto: .PHONY: lint lint: @go-cleanarch + @./scripts/lint.sh common @./scripts/lint.sh trainer @./scripts/lint.sh trainings @./scripts/lint.sh users diff --git a/internal/common/client/grpc.go b/internal/common/client/grpc.go index 391b8b0..c7ceea4 100644 --- a/internal/common/client/grpc.go +++ b/internal/common/client/grpc.go @@ -70,7 +70,8 @@ func grpcDialOpts(grpcAddr string) ([]grpc.DialOption, error) { return nil, errors.Wrap(err, "cannot load root CA cert") } creds := credentials.NewTLS(&tls.Config{ - RootCAs: systemRoots, + RootCAs: systemRoots, + MinVersion: tls.VersionTLS12, }) return []grpc.DialOption{ diff --git a/internal/common/server/http.go b/internal/common/server/http.go index d11214b..a7ad1e3 100644 --- a/internal/common/server/http.go +++ b/internal/common/server/http.go @@ -31,7 +31,7 @@ func RunHTTPServerOnAddr(addr string, createHandler func(router chi.Router) http logrus.Info("Starting HTTP server") - http.ListenAndServe(addr, rootRouter) + _ = http.ListenAndServe(addr, rootRouter) } func setMiddlewares(router *chi.Mux) { diff --git a/internal/common/tests/clients.go b/internal/common/tests/clients.go index 1e9b233..b98dead 100644 --- a/internal/common/tests/clients.go +++ b/internal/common/tests/clients.go @@ -49,6 +49,8 @@ func (c TrainerHTTPClient) MakeHourAvailable(t *testing.T, hour time.Time) int { Hours: []time.Time{hour}, }) require.NoError(t, err) + require.NoError(t, response.Body.Close()) + return response.StatusCode } @@ -57,6 +59,8 @@ func (c TrainerHTTPClient) MakeHourUnavailable(t *testing.T, hour time.Time) { Hours: []time.Time{hour}, }) require.NoError(t, err) + require.NoError(t, response.Body.Close()) + require.Equal(t, http.StatusNoContent, response.StatusCode) } @@ -113,6 +117,8 @@ func (c TrainingsHTTPClient) CreateTrainingShouldFail(t *testing.T, note string, Time: hour, }) require.NoError(t, err) + require.NoError(t, response.Body.Close()) + require.Equal(t, http.StatusInternalServerError, response.StatusCode) } @@ -127,6 +133,8 @@ func (c TrainingsHTTPClient) GetTrainings(t *testing.T) trainings.Trainings { func (c TrainingsHTTPClient) CancelTraining(t *testing.T, trainingUUID string, expectedStatusCode int) { response, err := c.client.CancelTraining(context.Background(), trainingUUID) require.NoError(t, err) + require.NoError(t, response.Body.Close()) + require.Equal(t, expectedStatusCode, response.StatusCode) }