Skip to content

Commit

Permalink
Added missing linter
Browse files Browse the repository at this point in the history
  • Loading branch information
roblaszczak committed Nov 30, 2021
1 parent f0a7bf4 commit 74a0270
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion internal/common/client/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion internal/common/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions internal/common/tests/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 74a0270

Please sign in to comment.