Skip to content

Commit

Permalink
feat: tool and test use sharding db
Browse files Browse the repository at this point in the history
--story=120526337
  • Loading branch information
wcy00000000000000 committed Nov 22, 2024
1 parent ae5065c commit 9f9055d
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 515 deletions.
6 changes: 3 additions & 3 deletions src/common/cryptor/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (

// Config defines cmdb crypto configuration
type Config struct {
Enabled bool `mapstructure:"enabled"`
Algorithm Algorithm `mapstructure:"algorithm"`
AesGcm *AesGcmConf `mapstructure:"aesGcm"`
Enabled bool `mapstructure:"enabled" json:"enabled"`
Algorithm Algorithm `mapstructure:"algorithm" json:"algorithm"`
AesGcm *AesGcmConf `mapstructure:"aesGcm" json:"aes_gcm,omitempty"`
}

// Validate Config
Expand Down
33 changes: 8 additions & 25 deletions src/test/host_server/host_ip_array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ package host_server_test

import (
"context"
"time"

"configcenter/src/common"
"configcenter/src/common/metadata"
"configcenter/src/storage/dal/mongo"
"configcenter/src/storage/dal/mongo/local"
"configcenter/src/storage/dal/redis"
"configcenter/src/storage/dal/types"
"configcenter/src/test"

Expand All @@ -31,29 +27,12 @@ import (
var _ = Describe("host ip array validation test", func() {
var find types.Find
It("test preparation", func() {
tConf := test.GetTestConfig()
mongoConfig := local.MongoConf{
MaxOpenConns: mongo.DefaultMaxOpenConns,
MaxIdleConns: mongo.MinimumMaxIdleOpenConns,
URI: tConf.MongoURI,
RsName: tConf.MongoRsName,
}
db, err := local.NewMgo(mongoConfig, time.Minute)
Expect(err).To(BeNil())

redisCfg := redis.Config{
Address: tConf.RedisCfg.RedisAddress,
Password: tConf.RedisCfg.RedisPasswd,
Database: "0",
}
redisClient, err := redis.NewFromConfig(redisCfg)
Expect(err).To(BeNil())
test.DeleteAllHosts()

err = db.InitTxnManager(redisClient)
Expect(err).To(BeNil())
err = db.Table(common.BKTableNameBaseHost).Insert(context.Background(), map[string]interface{}{"bk_host_innerip": []string{"127.0.0.1"}})
err := test.GetDB().Table(common.BKTableNameBaseHost).Insert(context.Background(),
map[string]interface{}{"bk_host_innerip": []string{"127.0.0.1"}})
Expect(err).To(BeNil())
find = db.Table(common.BKTableNameBaseHost).Find(nil).Fields(common.BKHostInnerIPField)
find = test.GetDB().Table(common.BKTableNameBaseHost).Find(nil).Fields(common.BKHostInnerIPField)
})

It("host ip array valid type test", func() {
Expand Down Expand Up @@ -120,5 +99,9 @@ var _ = Describe("host ip array validation test", func() {
err := find.All(context.Background(), &[]invalidStruct{})
Expect(err).NotTo(BeNil())
})

By("clean test data", func() {
test.DeleteAllHosts()
})
})
})
268 changes: 0 additions & 268 deletions src/test/load/db_load_test.go

This file was deleted.

29 changes: 0 additions & 29 deletions src/test/load/load_suite_test.go

This file was deleted.

Loading

0 comments on commit 9f9055d

Please sign in to comment.