2025-07-25 15:09:56: merge [main:fb882e5c5c84ea63967c2aa6e330dab7a9521182];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s

This commit is contained in:
txix committed 2025-07-25 15:09:56 +03:00
1 parent 7c9e12685d
commit 121f63f57a
24 files changed
+150 -510

No files matched your search

+1 -1
View File
@@ -66,7 +66,7 @@ func (t *AuditSuite) SetupTest() {
},
}
cfg := assembly.NewLocator(testInstance.Logger(), httpcli.New(), t.db).
Config(context.Background(), emptyLdap, remote, time.Minute)
Config(context.Background(), 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, time.Minute)
Config(context.Background(), remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
s.grpcCli = apiCli
+1 -1
View File
@@ -40,7 +40,7 @@ func (s *CustomizationTestSuite) SetupTest() {
ExpireSec: 0,
}
cfg := assembly.NewLocator(testInstance.Logger(), nil, s.db).
Config(context.Background(), emptyLdap, remote, time.Minute)
Config(context.Background(), remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
s.grpcCli = apiCli
+3 -3
View File
@@ -15,9 +15,9 @@ func InsertUser(db *dbt.TestDb, user entity.User) int64 {
user.Password = string(passwordBytes)
}
var id int64
db.Must().SelectRow(&id, `insert into users (first_name, last_name, email, password, blocked)
values($1,$2,$3,$4,$5) returning id`,
user.FirstName, user.LastName, user.Email, user.Password, user.Blocked)
db.Must().SelectRow(&id, `insert into users (first_name, last_name, email, password, blocked, last_active_at)
values($1,$2,$3,$4,$5,$6) returning id`,
user.FirstName, user.LastName, user.Email, user.Password, user.Blocked, user.LastActiveAt)
return id
}
+3 -17
View File
@@ -21,25 +21,11 @@ func TestInactiveWorker(t *testing.T) {
test, require := test.New(t)
db := dbt.New(test, dbx.WithMigrationRunner("../migrations", test.Logger()))
userId := InsertUser(db, entity.User{Email: "a@test"})
InsertUser(db, entity.User{Email: "b@test"})
InsertTokenEntity(db, entity.Token{
Id: 0,
Token: "123",
UserId: userId,
Status: entity.TokenStatusAllowed,
CreatedAt: time.Now().UTC().Add(-48 * time.Hour),
})
InsertTokenEntity(db, entity.Token{
Id: 0,
Token: "234",
UserId: userId,
Status: entity.TokenStatusAllowed,
CreatedAt: time.Now().UTC().Add(-5 * 24 * time.Hour),
})
userId := InsertUser(db, entity.User{Email: "a@test", LastActiveAt: time.Now().UTC().Add(-5 * 24 * time.Hour)})
InsertUser(db, entity.User{Email: "b@test", LastActiveAt: time.Now().UTC()})
config := assembly.NewLocator(test.Logger(), nil, db).
Config(t.Context(), emptyLdap, conf.Remote{
Config(t.Context(), conf.Remote{
BlockInactiveWorker: conf.BlockInactiveWorker{
DaysThreshold: 1,
RunIntervalInMinutes: 1,
-34
View File
@@ -1,34 +0,0 @@
package tests_test
import (
"context"
"msp-admin-service/conf"
"msp-admin-service/service/ldap"
)
type mockLdap struct {
}
func (m mockLdap) IsExist(ctx context.Context, dn string) (bool, error) {
return false, nil
}
func (m mockLdap) DnByUserPrincipalName(ctx context.Context, principalName string) (string, error) {
return principalName, nil
}
func (m mockLdap) ModifyMemberAttr(ctx context.Context, userDn string, groupDn string, operation string) error {
return nil
}
func (m mockLdap) Close() error {
return nil
}
var (
//nolint:gochecknoglobals
emptyLdap = ldap.RepoSupplier(func(config *conf.Ldap) (ldap.Repo, error) {
return mockLdap{}, nil
})
)
+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, time.Minute)
Config(context.Background(), 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, time.Minute)
Config(context.Background(), remote, time.Minute)
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
s.grpcCli = apiCli