Skip to content

Commit

Permalink
Fix: Fix the lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wjuniorbh92 committed Sep 28, 2023
1 parent 8aa2f87 commit 80f58f8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 26 deletions.
11 changes: 3 additions & 8 deletions backend/integration-test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@ import (
const (
// Attempts connection
host = "backend:8080"
healthPath = "http://" + host + "/healthz"
healthPath = "/healthz"
attempts = 20

// HTTP REST
basePath = "http://" + host + "/v1"

// Kafka
kafkaHost = "kafka:9092"
consumerTopic = "consumer_topic"
producerTopic = "producer_topic"
)

func TestMain(t *testing.M) {
Expand All @@ -41,12 +36,12 @@ func healthCheck(attempts int) error {
var err error

for attempts > 0 {
err = Do(Get(healthPath), Expect().Status().Equal(http.StatusOK))
err = Do(Get(basePath+healthPath), Expect().Status().Equal(http.StatusOK))
if err == nil {
return nil
}

log.Printf("Integration tests: url %s is not available, attempts left: %d", healthPath, attempts)
log.Printf("Integration tests: url %s is not available, attempts left: %d", basePath+healthPath, attempts)

time.Sleep(time.Second)

Expand Down
5 changes: 4 additions & 1 deletion backend/internal/controller/http/v1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ func (m *HTTPControllerMessenger) SendMessage(chanName string, value interface{}
}

res := <-channel
notify.Stop(msgKey, channel)
err = notify.Stop(msgKey, channel)
if err != nil {
return &entity.NotifyData{}, fmt.Errorf("sendMessage - notify.Stop: %v", err)
}
if notifyData, ok := res.(*entity.NotifyData); ok {
switch msg := notifyData.Message.(type) {
case entity.EnvelopeResponse:
Expand Down
10 changes: 0 additions & 10 deletions backend/internal/usecase/role_permission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ import (
"github.com/stretchr/testify/assert"
)

var validateError = errors.New("error")

type rolePermissionTest struct {
name string
roleId int
mock func()
res interface{}
err error
}

func TestRolePermissionUseCase_Validate(t *testing.T) {
t.Helper()

Expand Down
9 changes: 6 additions & 3 deletions backend/internal/usecase/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ func (uc *UserUseCase) CreateUser(user entity.User) error {
if err != nil {
return err
}
uc.repo.CreateUser(user)

err = uc.repo.CreateUser(user)
if err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -91,11 +95,10 @@ func (uc *UserUseCase) GetAllUsers() ([]entity.UserResponse, error) {
}

func (uc *UserUseCase) EditUsersRole(userRole entity.UserRole) error {
var err error
err := uc.repo.EditUsersRole(userRole.ID_user, userRole.ID_role)
if err != nil {
return err
}
uc.repo.EditUsersRole(userRole.ID_user, userRole.ID_role)
return nil
}

Expand Down
3 changes: 0 additions & 3 deletions backend/internal/usecase/vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,3 @@ func TestVaultUseCaseCreate(t *testing.T) {
})
}
}

func TestsVaultUseCaseUpdateVault(t *testing.T) {
}
6 changes: 5 additions & 1 deletion backend/pkg/kafka/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ func (c Connection) Run(cfg *config.Config, chanName string) {
fmt.Println(err)
continue
}
notify.Post(string(msg.Key), &entity.NotifyData{Key: string(msg.Key), Message: data})
err = notify.Post(string(msg.Key), &entity.NotifyData{Key: string(msg.Key), Message: data})
if err != nil {
fmt.Println(err)
continue
}
}
}
}

0 comments on commit 80f58f8

Please sign in to comment.