type DataPath struct { basedto.BaseEntitySingle RootDir string `json:"root_dir"` DataInPath string `json:"data_in_path"` DataInPathEs string `json:"data_in_path_es"` DataOutPath string `json:"data_out_path"` DataCode string `json:"data_code"` DataFileEs string `json:"data_file_es"` }
type TestDataPathSuite struct { suite.Suite inst *basedata.DataPath rootdir string dbtype string cfg *ichubconfig.IchubConfig }测试路径
func (self *TestDataPathSuite) Test001_ReadFile() { logrus.Info(self.inst) }INFO[2025-05-526 16:31:27]E:/git.ichub.com/webcli120/test/datafile/data_path_test.go:56 git.ichub.com/general/webcli120/test/datafile.(*TestDataPathSuite).Test001_ReadFile() { "root_dir": "E:\\git.ichub.com\\webcli120", "data_in_path": "E:\\git.ichub.com\\webcli120/data/input/", "data_in_path_es": "E:\\git.ichub.com\\webcli120/data/input/es/", "data_out_path": "E:\\git.ichub.com\\webcli120/data/output/", "data_code": "E:\\git.ichub.com\\webcli120/data/code/internal/", "data_file_es": "E:\\git.ichub.com\\webcli120/data/input/es/order_query_agg.json" }
eswebclient
func (self *TestWebQuerySuite) Test306_webcli_query() { var req = pagereq.Default() req.IndexName = "dev_wms_orderlist" req.SetSource("trade,id") req.SetPageSize(3) req.OrderBy("id", "asc") req.OrderBy("trade", "desc") var ret, err = req.Query() logrus.Info(ret, err) self.Equal(200, ret.Code) }
结果
INFO[2025-05-526 16:33:19]E:/git.ichub.com/webcli120/test/eswebclient/webclient_query_test.go:725 git.ichub.com/general/webcli120/test/eswebclient.(*TestWebQuerySuite).Test306_webcli_query() {
"code": 200,
"msg": "成功",
"data": [
{
"trade": 0,
"id": 0
},
{
"id": 752625395557171201
},
{
"id": 752625395671367681
}
],
"exist": false,
"total": 652,
"page_size": 3,
"current": 1,
"cmd_name": "must",
"data_highlight": [],
"request_id": "6964447c-8268-4996-9e07-e6ed4c0a8d56"
} <nil>
goconfig
func Test010_readVar2SoftwareDto(t *testing.T) { golog.Info("cfg:",ichubconfig.FindBeanIchubConfig().Read()) } 2025-05-26 16:34:45.163 [INFO] cfg: { "ichubConfigGrpc": {}, "env": "raymondtest", "useCommon": "", "base_path": "E:\\git.ichub.com\\webcli120", "env_config_file": "/config/env.yml", "config_file": "/config/ichub.yml", "real_config_file": "/config/ichub-raymondtest.yml", "software": { "env": "test", "author": "leijmdas@163.com", "webPrefix": "/website/v3", "corp": "www.ichub.com", "logLevel": "DEBU", "version": "V20240821-01", "salt": "", "name": "", "Platform": { "ShopId": "741279793909825537" } }, "nats": { "url": "nats://huawei.akunlong.top:4222", "timeout": "10", "Subscribe": { "TopicSync": "GeneralEsSync.*", "TopicAsync": "GeneralEsAsync.*" } }, "Etcd": { "Server": { "hosturl": "huawei.akunlong.top:2379" } }, "Rpc": { "servername": "gorpc.hello-server.com", "version": "latest", "serverport": "1301" }, "web": { "Server": { "name": "web.webserver.com", "port": 301, "ver": "latest", "backend": "" }, "client": { "name": "web.webserver.com", "test_url": "http://localhost:301/website/v3", "web_timeout": "30" }, "swagger": { "host": "localhost:301/website/v3", "base_path": "/", "version": "", "title": "有芯服务-WebServer", "enable": "true" }, "wso2agent": { "name": "web.wso2gent.com", "test_url": "http://localhost:211", "web_timeout": "30" }, "dbclient": { "name": "web.dbserver.com", "test_url": "http://localhost:91", "web_timeout": "30" }, "esclient": { "name": "web.esserver.com", "test_url": "http://192.168.27.144:88", "web_timeout": "30" }, "ruleclient": { "name": "web.ruleserver.com", "test_url": "http://localhost:89", "web_timeout": "30" }, "statclient": { "name": "web.statserver.com", "test_url": "http://localhost:90", "web_timeout": "30" } }, "Es": { "enable": "true", "url": "http://192.168.27.24:9200,http://192.168.27.25:9200,http://192.168.27.26:9200", "username": "elastic", "password": "123456", "sniffEnabled": "false", "healthcheckInterval": 10 }, "Gorm": { "debug": "true", "db_type": "cockroach", "enabled": "true", "max_idletime": "900", "max_lifetime": "7200", "max_open_conns": "150", "max_idle_conns": "50" }, "Datasource": { "dbtype": "cockroach", "dbname": "ichub2_release", "host": "192.168.27.22", "port": "26257", "username": "crrelease", "password": "Ichubrel1818", "sslmode": "require", "charset": "utf8" }, "redis": { "db": 8, "addr": "192.168.27.21:7000,192.168.27.22:7100,192.168.27.23:7000,192.168.27.21:7100,192.168.27.22:7000,192.168.27.23:7100", "password": "XOBRB1YmAgxW0Jkc81WcauYVWn8UA4fgZxK7pca0PaOjCQ/25J2eb3GENF7gkfEzrkvHC5+uUmlNV9nH" }, "medusa": { "db_conn_name": "", "dbtype": "postgres", "dbname": "${DB_NAME:uz_dev}", "host": "${DB_HOST:192.168.27.30}", "port": "${DB_PORT:5432}", "username": "${DB_USER:medusa_user}", "password": "${DB_PASSWORD:medusa1234}", "sslmode": "${DB_SSLMODE:require}", "charset": "utf8", "gorm_client": null }, "mysql": { "dbtype": "mysql", "dbname": "goplatform", "host": "huawei.akunlong.top", "port": "13306", "username": "root", "password": "leijmdas@163.comL", "sslmode": "", "charset": "utf8" }, "clickhouse": { "dbtype": "clickhouse", "dbname": "goplatform", "host": "huawei.akunlong.top", "port": "13306", "username": "root", "password": "leijmdas@163.comL", "sslmode": "", "charset": "utf8" }, "ipfs": { "upload": "http://192.168.27.36:5001", "download": "http://192.168.27.36:8080,http://192.168.27.37:8080,http://192.168.27.38:8080" }, "Factroy": { "Author": "leijianming@163.com", "PkgNew": "git.ichub.com/general/webcli120/code/postgres/db/", "PkgNow": "git.ichub.com/general/gocode/mysql/" } }
func Test0006_QueryServicePolicys(t *testing.T) { var dbRequest = pagedb.Default() dbRequest.PageSize = 4 dbRequest.TableName = "service_policy_instances" var ret = dbRequest.GeneralQuery() golog.Info(ret) assert.Equal(t, 200, ret.Code) }2025-05-26 16:37:30.531 [INFO] { "code": 200, "msg": "成功", "data": [ {"active":true,"created_at":"2024-05-09T17:26:10.7883+08:00","created_by":-1,"deleted_at":"0001-01-01T00:00:00Z","deleted_by":0,"id":967233931825676291,"object_id":-1,"object_type":"member","shop_id":-1,"shop_member_id":-1,"state":"L","subject_type":"platform","template_id":967228654376976387,"updated_at":"0001-01-01T00:00:00Z","updated_by":0}, {"active":true,"created_at":"2024-05-09T17:31:47.653844+08:00","created_by":673093250576678913,"deleted_at":"0001-01-01T00:00:00Z","deleted_by":0,"id":967235035678932995,"object_id":764235739445166081,"object_type":"member","shop_id":-1,"shop_member_id":764235739445166081,"state":"L","subject_type":"member","template_id":967228654376976387,"updated_at":"2024-05-09T17:31:47.653844+08:00","updated_by":0}, {"active":true,"created_at":"2024-05-09T17:32:53.593168+08:00","created_by":-1,"deleted_at":"0001-01-01T00:00:00Z","deleted_by":0,"id":967235251706298371,"object_id":-1,"object_type":"shop","shop_id":-1,"shop_member_id":-1,"state":"L","subject_type":"platform","template_id":967228558252310531,"updated_at":"0001-01-01T00:00:00Z","updated_by":0}, {"active":true,"created_at":"2024-05-09T17:45:43.840941+08:00","created_by":-1,"deleted_at":"0001-01-01T00:00:00Z","deleted_by":0,"id":967237775645704195,"object_id":-1,"object_type":"shop","shop_id":-1,"shop_member_id":-1,"state":"L","subject_type":"platform","template_id":967230435073523715,"updated_at":"0001-01-01T00:00:00Z","updated_by":0} ], "exist": false, "total": 31, "page_size": 4, "current": 1 }