2025-03-26 11:35:49: merge [main:635046d221d1e642ece7da4fcc3c8cb5a946ef9d];

This commit is contained in:
txix committed 2025-03-26 11:35:49 +03:00
1 parent e1de1c31d8
commit 3bbe1c3952
16 files changed
+270 -126

No files matched your search

+2 -1
View File
@@ -3,6 +3,7 @@ package tests_test
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/suite"
"github.com/txix-open/isp-kit/dbx"
@@ -65,7 +66,7 @@ func (t *AuditSuite) SetupTest() {
},
}
cfg := assembly.NewLocator(testInstance.Logger(), httpcli.New(), t.db).
Config(context.Background(), emptyLdap, remote)
Config(context.Background(), emptyLdap, remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
t.grpcCli = apiCli
+1 -1
View File
@@ -65,7 +65,7 @@ func (s *AuthTestSuite) SetupTest() {
},
}
cfg := assembly.NewLocator(testInstance.Logger(), s.httpCli, s.db).
Config(context.Background(), emptyLdap, remote)
Config(context.Background(), emptyLdap, remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
s.grpcCli = apiCli
+2 -1
View File
@@ -3,6 +3,7 @@ package tests_test
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/suite"
"github.com/txix-open/isp-kit/dbx"
@@ -39,7 +40,7 @@ func (s *CustomizationTestSuite) SetupTest() {
ExpireSec: 0,
}
cfg := assembly.NewLocator(testInstance.Logger(), nil, s.db).
Config(context.Background(), emptyLdap, remote)
Config(context.Background(), emptyLdap, remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
s.grpcCli = apiCli
+9 -10
View File
@@ -1,7 +1,7 @@
package tests_test
import (
"context"
"msp-admin-service/service/inactive_worker"
"testing"
"time"
@@ -13,7 +13,6 @@ import (
"msp-admin-service/conf"
"msp-admin-service/entity"
"msp-admin-service/repository"
"msp-admin-service/service/inactive_worker"
)
func TestInactiveWorker(t *testing.T) {
@@ -40,26 +39,26 @@ func TestInactiveWorker(t *testing.T) {
})
config := assembly.NewLocator(test.Logger(), nil, db).
Config(context.Background(), emptyLdap, conf.Remote{
Config(t.Context(), emptyLdap, conf.Remote{
BlockInactiveWorker: conf.BlockInactiveWorker{
DaysThreshold: 1,
RunIntervalInMinutes: 60,
RunIntervalInMinutes: 1,
},
})
}, 500*time.Millisecond)
bgjobCli := bgjobx.NewClient(db, test.Logger())
assembly.JobPollInterval = 300 * time.Millisecond
err := bgjobCli.Upgrade(context.Background(), config.BgJobCfg)
err := inactive_worker.EnqueueSeedJob(t.Context(), bgjobCli)
require.NoError(err)
err = inactive_worker.EnqueueSeedJob(context.Background(), bgjobCli)
err = bgjobCli.Upgrade(t.Context(), config.BgJobCfg)
require.NoError(err)
time.Sleep(5 * time.Second)
user, err := repository.NewUser(db).GetUserById(context.Background(), userId)
user, err := repository.NewUser(db).GetUserById(t.Context(), userId)
require.NoError(err)
require.True(user.Blocked)
list, err := repository.NewAudit(db).All(context.Background(), 10, 0)
list, err := repository.NewAudit(db).All(t.Context(), 10, 0)
require.NoError(err)
require.Len(list, 1)
}
+1 -1
View File
@@ -40,7 +40,7 @@ func (s *SecureSuite) SetupTest() {
ExpireSec: 3600,
}
cfg := assembly.NewLocator(s.test.Logger(), httpCli, s.db).
Config(context.Background(), emptyLdap, remote)
Config(context.Background(), emptyLdap, remote, time.Minute)
server, apiCli := grpct.TestServer(s.test, cfg.Handler)
s.test.T().Cleanup(func() {
+1 -1
View File
@@ -54,7 +54,7 @@ func (s *UserTestSuite) SetupTest() {
ExpireSec: 0,
}
cfg := assembly.NewLocator(testInstance.Logger(), s.httpCli, s.db).
Config(context.Background(), emptyLdap, remote)
Config(context.Background(), emptyLdap, remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
s.grpcCli = apiCli