MSP-3428 fix linter
This commit is contained in:
1 parent
8b8bc04fbf
commit
7108122102
4 files changed
+16
-13
No files matched your search
@@ -23,7 +23,7 @@ type Assembly struct {
|
||||
}
|
||||
|
||||
func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
|
||||
dbCli := dbrx.New(dbx.WithMigration(boot.MigrationsDir))
|
||||
dbCli := dbrx.New(dbx.WithMigrationRunner(boot.MigrationsDir, boot.App.Logger()))
|
||||
server := grpc.NewServer()
|
||||
|
||||
return &Assembly{
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Type) {
|
||||
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
|
||||
t.Type = "string"
|
||||
t.Enum = []interface{}{"debug", "info", "error", "fatal"}
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -47,7 +47,7 @@ func (i *initializeMigration) SetParams(migrationDir string, schema string) {
|
||||
|
||||
func (i *initializeMigration) Up(tx *sql.Tx) error {
|
||||
path := filepath.Join(i.migrationDir, initFile)
|
||||
bytes, err := ioutil.ReadFile(path)
|
||||
bytes, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "read file")
|
||||
}
|
||||
|
||||
+12
-9
@@ -2,12 +2,12 @@ package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/txix-open/isp-kit/dbx/migration"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/txix-open/isp-kit/dbx/migration"
|
||||
"github.com/txix-open/isp-kit/grpc/client"
|
||||
"github.com/txix-open/isp-kit/test"
|
||||
"github.com/txix-open/isp-kit/test/dbt"
|
||||
@@ -40,7 +40,10 @@ func (s *SecureSuite) SetupSuite() {
|
||||
db, err := s.testDb.DB()
|
||||
s.require.NoError(err)
|
||||
|
||||
err = migration.NewRunner(db.DB.DB, "../migrations").Run()
|
||||
logger := s.test.Logger()
|
||||
|
||||
err = migration.NewRunner(migration.DialectPostgreSQL, "../migrations", logger).Run(context.Background(), db.DB.DB)
|
||||
|
||||
s.require.NoError(err)
|
||||
|
||||
locator := assembly.NewLocator(s.testDb, s.test.Logger())
|
||||
@@ -69,7 +72,7 @@ func (s *SecureSuite) TestAuthenticate_Success() {
|
||||
JsonRequestBody(domain.AuthenticateRequest{
|
||||
Token: "test_token_success",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthenticateResponse{
|
||||
@@ -90,7 +93,7 @@ func (s *SecureSuite) TestAuthenticate_NotFound() {
|
||||
JsonRequestBody(domain.AuthenticateRequest{
|
||||
Token: "test_token_not_found",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthenticateResponse{
|
||||
@@ -110,7 +113,7 @@ func (s *SecureSuite) TestAuthenticate_NotExpired() {
|
||||
JsonRequestBody(domain.AuthenticateRequest{
|
||||
Token: "test_token_not_expired",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthenticateResponse{
|
||||
@@ -135,7 +138,7 @@ func (s *SecureSuite) TestAuthenticate_Expired() {
|
||||
JsonRequestBody(domain.AuthenticateRequest{
|
||||
Token: "test_token_expired",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthenticateResponse{
|
||||
@@ -158,7 +161,7 @@ func (s *SecureSuite) TestAuthorize_Success_True() {
|
||||
ApplicationId: 7,
|
||||
Endpoint: "endpoint/available",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthorizeResponse{
|
||||
@@ -179,7 +182,7 @@ func (s *SecureSuite) TestAuthorize_Success_False() {
|
||||
ApplicationId: 7,
|
||||
Endpoint: "endpoint/not_available",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthorizeResponse{
|
||||
@@ -194,7 +197,7 @@ func (s *SecureSuite) TestAuthorize_NotFound() {
|
||||
ApplicationId: 7,
|
||||
Endpoint: "endpoint/not_found",
|
||||
}).
|
||||
ReadJsonResponse(&result).
|
||||
JsonResponseBody(&result).
|
||||
Do(context.Background())
|
||||
s.require.NoError(err)
|
||||
s.require.Equal(domain.AuthorizeResponse{
|
||||
|
||||
Reference in new issue
Block a user