12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112 |
- package v1
- import (
- "fmt"
- "git.sxidc.com/service-supports/dps-sdk/client"
- uuid "github.com/satori/go.uuid"
- "math/rand"
- "strings"
- "testing"
- "time"
- )
- func getUUID() string {
- return uuid.NewV4().String()
- }
- func simpleUUID() string {
- return strings.ReplaceAll(getUUID(), "-", "")
- }
- var tableModelDescribe = map[string]string{
- "ID": "gorm:\"primary_key;type:varchar(32);comment:id;\"",
- "Name": "gorm:\"not null;type:varchar(128);comment:数据库名称;\"",
- "Time": "gorm:\"not null;type:timestamp with time zone;comment:数据库时间;\"",
- "TableNum": "gorm:\"not null;type:integer;comment:数据库表数量;\"",
- }
- func TestAutoMigrate(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: "test." + simpleUUID()[0:8],
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- })
- }
- func TestTransaction(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id := simpleUUID()
- name := simpleUUID()
- now := time.Now().Local()
- tableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- newName := simpleUUID()
- newNow := time.Now().Local()
- newTableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- var count int64
- resultTableRow := client.NewTableRow()
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- transaction(func(tx client.Transaction) error {
- statement, err := tx.InsertTx(&client.InsertRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- })
- if err != nil {
- return err
- }
- fmt.Println(statement)
- return nil
- }).
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- }, resultTableRow).
- assertEqual(id, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(name, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(now.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum, resultTableRow.ColumnValueInt("table_num"), "表数量不一致").
- transaction(func(tx client.Transaction) error {
- statement, err := tx.UpdateTx(&client.UpdateRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- NewTableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", newName).
- AddColumnValueTime("time", newNow).
- AddColumnValueInt("table_num", newTableNum),
- UserID: "test",
- })
- if err != nil {
- return err
- }
- fmt.Println(statement)
- return nil
- }).
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- }, resultTableRow).
- assertEqual(id, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(newName, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(newNow.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(newTableNum, resultTableRow.ColumnValueInt("table_num"), "表数量不一致").
- transaction(func(tx client.Transaction) error {
- statement, err := tx.UpdateTx(&client.UpdateRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- NewTableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- })
- if err != nil {
- return err
- }
- fmt.Println(statement)
- statement, err = tx.DeleteTx(&client.DeleteRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- UserID: "test",
- })
- if err != nil {
- return err
- }
- fmt.Println(statement)
- return nil
- }).
- countWhere(&client.CountWhereRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ?": {id},
- },
- }, &count).
- assertEqual(int64(0), count, "数量不一致")
- }
- func TestTransactionBatch(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id1 := simpleUUID()
- name1 := simpleUUID()
- now1 := time.Now().Local()
- tableNum1 := rand.New(rand.NewSource(now1.Unix())).Intn(10)
- id2 := simpleUUID()
- name2 := simpleUUID()
- now2 := time.Now().Local()
- tableNum2 := rand.New(rand.NewSource(now2.Unix())).Intn(10)
- var count int64
- resultTableRow := client.NewTableRow()
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- transaction(func(tx client.Transaction) error {
- statement, err := tx.InsertBatchTx(&client.InsertBatchRequest{
- Items: []client.InsertTableRowItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRows: []*client.TableRow{
- client.NewTableRow().
- AddColumnValueString("id", id1).
- AddColumnValueString("name", name1).
- AddColumnValueTime("time", now1).
- AddColumnValueInt("table_num", tableNum1),
- client.NewTableRow().
- AddColumnValueString("id", id2).
- AddColumnValueString("name", name2).
- AddColumnValueTime("time", now2).
- AddColumnValueInt("table_num", tableNum2),
- },
- },
- },
- })
- if err != nil {
- return err
- }
- fmt.Println(statement)
- return nil
- }).
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id1},
- }, resultTableRow).
- assertEqual(id1, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(name1, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(now1.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum1, resultTableRow.ColumnValueInt("table_num"), "表数量不一致").
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id2},
- }, resultTableRow).
- assertEqual(id2, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(name2, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(now2.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum2, resultTableRow.ColumnValueInt("table_num"), "表数量不一致").
- transaction(func(tx client.Transaction) error {
- statement, err := tx.DeleteBatchTx(&client.DeleteBatchRequest{
- Items: []client.DeleteTableRowItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: []map[string]string{
- {"id": id1},
- {"id": id2},
- },
- },
- },
- UserID: "test",
- })
- if err != nil {
- return err
- }
- fmt.Println(statement)
- return nil
- }).
- countWhere(&client.CountWhereRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ?": {id1},
- },
- }, &count).
- assertEqual(int64(0), count, "数量不一致").
- countWhere(&client.CountWhereRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ?": {id2},
- },
- }, &count).
- assertEqual(int64(0), count, "数量不一致")
- }
- func TestInsert(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id := simpleUUID()
- name := simpleUUID()
- now := time.Now().Local()
- tableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- resultTableRow := client.NewTableRow()
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insert(&client.InsertRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- }).
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- }, resultTableRow).
- assertEqual(id, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(name, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(now.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum, resultTableRow.ColumnValueInt("table_num"), "表数量不一致")
- }
- func TestInsertBatch(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id1 := simpleUUID()
- name1 := simpleUUID()
- now1 := time.Now().Local()
- tableNum1 := rand.New(rand.NewSource(now1.Unix())).Intn(10)
- id2 := simpleUUID()
- name2 := simpleUUID()
- now2 := time.Now().Local()
- tableNum2 := rand.New(rand.NewSource(now2.Unix())).Intn(10)
- resultTableRows := make([]client.TableRow, 0)
- var totalCount int64
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insertBatch(&client.InsertBatchRequest{
- Items: []client.InsertTableRowItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRows: []*client.TableRow{
- client.NewTableRow().
- AddColumnValueString("id", id1).
- AddColumnValueString("name", name1).
- AddColumnValueTime("time", now1).
- AddColumnValueInt("table_num", tableNum1),
- client.NewTableRow().
- AddColumnValueString("id", id2).
- AddColumnValueString("name", name2).
- AddColumnValueTime("time", now2).
- AddColumnValueInt("table_num", tableNum2),
- },
- },
- },
- }).
- queryByWhereAndOrderBy(&client.QueryByWhereAndOrderByRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ? AND name = ? AND table_num = ?": {id1, name1, tableNum1},
- },
- PageNo: 1,
- PageSize: 1,
- }, &resultTableRows, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(id1, resultTableRows[0].ColumnValueString("id"), "ID不一致").
- assertEqual(name1, resultTableRows[0].ColumnValueString("name"), "名称不一致").
- assertEqual(now1.Unix(), resultTableRows[0].ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum1, resultTableRows[0].ColumnValueInt("table_num"), "表数量不一致").
- commonQuery(&client.CommonQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ? AND name = ? AND table_num = ?": {id2, name2, tableNum2},
- },
- PageNo: 1,
- PageSize: 1,
- }, &resultTableRows, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(id2, resultTableRows[0].ColumnValueString("id"), "ID不一致").
- assertEqual(name2, resultTableRows[0].ColumnValueString("name"), "名称不一致").
- assertEqual(now2.Unix(), resultTableRows[0].ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum2, resultTableRows[0].ColumnValueInt("table_num"), "表数量不一致").
- queryOnlyByWhereAndOrderBy(&client.QueryByWhereAndOrderByRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ? AND name = ? AND table_num = ?": {id1, name1, tableNum1},
- },
- PageNo: 1,
- PageSize: 1,
- }, &resultTableRows).
- assertEqual(id1, resultTableRows[0].ColumnValueString("id"), "ID不一致").
- assertEqual(name1, resultTableRows[0].ColumnValueString("name"), "名称不一致").
- assertEqual(now1.Unix(), resultTableRows[0].ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum1, resultTableRows[0].ColumnValueInt("table_num"), "表数量不一致").
- commonQueryOnly(&client.CommonQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ? AND name = ? AND table_num = ?": {id2, name2, tableNum2},
- },
- PageNo: 1,
- PageSize: 1,
- }, &resultTableRows).
- assertEqual(id2, resultTableRows[0].ColumnValueString("id"), "ID不一致").
- assertEqual(name2, resultTableRows[0].ColumnValueString("name"), "名称不一致").
- assertEqual(now2.Unix(), resultTableRows[0].ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum2, resultTableRows[0].ColumnValueInt("table_num"), "表数量不一致")
- }
- func TestUpdate(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id := simpleUUID()
- name := simpleUUID()
- now := time.Now().Local()
- tableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- newName := simpleUUID()
- newNow := time.Now().Local()
- newTableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- resultTableRow := client.NewTableRow()
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insert(&client.InsertRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- }).
- update(&client.UpdateRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- NewTableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", newName).
- AddColumnValueTime("time", newNow).
- AddColumnValueInt("table_num", newTableNum),
- UserID: "test",
- }).
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- }, resultTableRow).
- assertEqual(id, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(newName, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(newNow.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(newTableNum, resultTableRow.ColumnValueInt("table_num"), "表数量不一致")
- }
- func TestDelete(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id := simpleUUID()
- name := simpleUUID()
- now := time.Now().Local()
- tableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- var count int64
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insert(&client.InsertRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- }).
- delete(&client.DeleteRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- UserID: "test",
- }).
- countWhere(&client.CountWhereRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- Where: map[string][]any{
- "id = ?": {id},
- },
- }, &count).
- assertEqual(int64(0), count, "数量不一致")
- }
- func TestDeleteBatch(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id1 := simpleUUID()
- name1 := simpleUUID()
- now1 := time.Now().Local()
- tableNum1 := rand.New(rand.NewSource(now1.Unix())).Intn(10)
- id2 := simpleUUID()
- name2 := simpleUUID()
- now2 := time.Now().Local()
- tableNum2 := rand.New(rand.NewSource(now2.Unix())).Intn(10)
- var count int64
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insertBatch(&client.InsertBatchRequest{
- Items: []client.InsertTableRowItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRows: []*client.TableRow{
- client.NewTableRow().
- AddColumnValueString("id", id1).
- AddColumnValueString("name", name1).
- AddColumnValueTime("time", now1).
- AddColumnValueInt("table_num", tableNum1),
- client.NewTableRow().
- AddColumnValueString("id", id2).
- AddColumnValueString("name", name2).
- AddColumnValueTime("time", now2).
- AddColumnValueInt("table_num", tableNum2),
- },
- },
- },
- }).
- deleteBatch(&client.DeleteBatchRequest{
- Items: []client.DeleteTableRowItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: []map[string]string{
- {"id": id1},
- {"id": id2},
- },
- },
- },
- UserID: "test",
- }).
- commonCount(&client.CommonCountRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- }, &count).
- assertEqual(int64(0), count, "数量不一致")
- }
- func TestReply(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id := simpleUUID()
- name := simpleUUID()
- now := time.Now().Local()
- tableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- resultTableRow := client.NewTableRow()
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insert(&client.InsertRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- }).
- reply(&client.ReplayRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- UserID: "test",
- }).
- queryByKeys(&client.QueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- }, resultTableRow).
- assertEqual(id, resultTableRow.ColumnValueString("id"), "ID不一致").
- assertEqual(name, resultTableRow.ColumnValueString("name"), "名称不一致").
- assertEqual(now.Unix(), resultTableRow.ColumnValueTime("time").Unix(), "时间不一致").
- assertEqual(tableNum, resultTableRow.ColumnValueInt("table_num"), "表数量不一致")
- }
- func TestEventQuery(t *testing.T) {
- initClient(t, "localhost:30170", "2b78141779ee432295ca371b91c5cac7")
- defer destroyClient(t, "2b78141779ee432295ca371b91c5cac7")
- tablePrefix := "test." + simpleUUID()[0:8]
- id := simpleUUID()
- name := simpleUUID()
- now := time.Now().Local()
- tableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- newName := simpleUUID()
- newNow := time.Now().Local()
- newTableNum := rand.New(rand.NewSource(now.Unix())).Intn(10)
- var totalCount int64
- eventInfos := make([]client.EventInfo, 0)
- newToolKit(t).
- autoMigrate(&client.AutoMigrateRequest{
- Items: []client.AutoMigrateItem{
- {
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- TableModelDescribe: tableModelDescribe,
- },
- },
- }).
- insert(&client.InsertRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyColumns: []string{"id"},
- TableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", name).
- AddColumnValueTime("time", now).
- AddColumnValueInt("table_num", tableNum),
- UserID: "test",
- }).
- update(&client.UpdateRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- NewTableRow: client.NewTableRow().
- AddColumnValueString("id", id).
- AddColumnValueString("name", newName).
- AddColumnValueTime("time", newNow).
- AddColumnValueInt("table_num", newTableNum),
- UserID: "test",
- }).
- countEventByKeys(&client.CountEventByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- }, &totalCount).
- assertEqual(2, int(totalCount), "总数不一致").
- commonCountEvent(&client.CommonCountEventRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "create",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- }, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- commonCountEvent(&client.CommonCountEventRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "update",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- }, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- eventQueryByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(2, int(totalCount), "总数不一致").
- assertEqual(2, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- assertEqual(id, eventInfos[1].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[1].Version, "版本不一致").
- assertEqual("update", eventInfos[1].Operation, "操作不一致").
- assertEqual("test", eventInfos[1].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[1].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[1].Value, "值为空不一致").
- eventQueryByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 1,
- PageSize: 1,
- }, &eventInfos, &totalCount).
- assertEqual(2, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventQuery(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "create",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventQuery(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "update",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("update", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- eventQueryOnlyByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(2, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- assertEqual(id, eventInfos[1].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[1].Version, "版本不一致").
- assertEqual("update", eventInfos[1].Operation, "操作不一致").
- assertEqual("test", eventInfos[1].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[1].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[1].Value, "值为空不一致").
- eventQueryOnlyByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 1,
- PageSize: 1,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventQueryOnly(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "create",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventQueryOnly(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "update",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("update", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- delete(&client.DeleteRequest{
- TablePrefixWithSchema: tablePrefix,
- Version: "v1",
- KeyValues: map[string]string{"id": id},
- UserID: "test",
- }).
- countEventHistoryByKeys(&client.CountEventByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- }, &totalCount).
- assertEqual(3, int(totalCount), "总数不一致").
- commonCountEventHistory(&client.CommonCountEventRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "create",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- }, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- commonCountEventHistory(&client.CommonCountEventRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "update",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- }, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- commonCountEventHistory(&client.CommonCountEventRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "delete",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- }, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- eventHistoryQueryByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(3, int(totalCount), "总数不一致").
- assertEqual(3, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- assertEqual(id, eventInfos[1].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[1].Version, "版本不一致").
- assertEqual("update", eventInfos[1].Operation, "操作不一致").
- assertEqual("test", eventInfos[1].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[1].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[1].Value, "值为空不一致").
- assertEqual(id, eventInfos[2].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[2].Version, "版本不一致").
- assertEqual("delete", eventInfos[2].Operation, "操作不一致").
- assertEqual("test", eventInfos[2].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[2].CreateTime, "创建事件为空").
- assertEqual("", eventInfos[2].Value, "值为空不一致").
- eventHistoryQueryByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 1,
- PageSize: 1,
- }, &eventInfos, &totalCount).
- assertEqual(3, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventHistoryQuery(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "create",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventHistoryQuery(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "update",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("update", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventHistoryQuery(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "delete",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos, &totalCount).
- assertEqual(1, int(totalCount), "总数不一致").
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("delete", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertEqual("", eventInfos[0].Value, "值为空不一致").
- eventHistoryQueryOnlyByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(3, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- assertEqual(id, eventInfos[1].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[1].Version, "版本不一致").
- assertEqual("update", eventInfos[1].Operation, "操作不一致").
- assertEqual("test", eventInfos[1].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[1].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[1].Value, "值为空不一致").
- assertEqual(id, eventInfos[2].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[2].Version, "版本不一致").
- assertEqual("delete", eventInfos[2].Operation, "操作不一致").
- assertEqual("test", eventInfos[2].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[2].CreateTime, "创建事件为空").
- assertEqual("", eventInfos[2].Value, "值为空不一致").
- eventHistoryQueryOnlyByKeys(&client.EventQueryByKeysRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- PageNo: 1,
- PageSize: 1,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventHistoryQueryOnly(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "create",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("create", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventHistoryQueryOnly(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "update",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("update", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertNotEmpty(eventInfos[0].Value, "值为空不一致").
- commonEventHistoryQueryOnly(&client.CommonEventQueryRequest{
- TablePrefixWithSchema: tablePrefix,
- KeyValues: []string{id},
- Version: "v1",
- Operation: "delete",
- CreatorID: "test",
- StartCreatedTime: now.Format(time.DateTime),
- EndCreatedTime: now.Add(time.Second).Format(time.DateTime),
- PageNo: 0,
- PageSize: 0,
- }, &eventInfos).
- assertEqual(1, len(eventInfos), "事件数量不一致").
- assertEqual(id, eventInfos[0].Key, "关键字段不一致").
- assertEqual("v1", eventInfos[0].Version, "版本不一致").
- assertEqual("delete", eventInfos[0].Operation, "操作不一致").
- assertEqual("test", eventInfos[0].CreatorID, "创建者ID不一致").
- assertNotEmpty(eventInfos[0].CreateTime, "创建事件为空").
- assertEqual("", eventInfos[0].Value, "值为空不一致")
- }
|