From 7e2e317b06b0a54fc12ea7791723ae7d2e8ffead Mon Sep 17 00:00:00 2001 From: Chih Cheng Liang Date: Tue, 3 Nov 2020 22:17:02 +0800 Subject: [PATCH 1/5] add popTxs test --- core/tx_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ go.mod | 5 ++--- go.sum | 4 ++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 core/tx_test.go diff --git a/core/tx_test.go b/core/tx_test.go new file mode 100644 index 0000000..898c012 --- /dev/null +++ b/core/tx_test.go @@ -0,0 +1,40 @@ +package core + +import ( + "io/ioutil" + "log" + "os" + "testing" + + "github.com/BOPR/common" + "github.com/jinzhu/gorm" + "github.com/stretchr/testify/assert" + "gorm.io/driver/sqlite" +) + +func TestPopTx(t *testing.T) { + tmpfile, err := ioutil.TempFile("", "test.db") + if err != nil { + log.Fatal(err) + } + + defer os.Remove(tmpfile.Name()) + + db, err := gorm.Open("sqlite", sqlite.Open("gorm.db")) + logger := common.Logger.With("module", "DB") + txDB := DB{Instance: db, Logger: logger} + + tx1 := NewTx(1, 2, 1, []byte{00}, []byte{00}) + tx2 := NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) + tx3 := NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) + + txDB.InsertTx(&tx1) + txDB.InsertTx(&tx2) + txDB.InsertTx(&tx3) + + txs, err := txDB.PopTxs() + if err != nil { + t.Errorf("PopTxs error %s", err) + } + assert.Equal(t, txs, []Tx{tx2, tx3}) +} diff --git a/go.mod b/go.mod index 01a3e2b..4016f1e 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 github.com/go-kit/kit v0.10.0 // indirect github.com/gogo/protobuf v1.3.1 // indirect - github.com/google/go-cmp v0.4.0 // indirect + github.com/golang/protobuf v1.3.3 // indirect github.com/google/uuid v1.1.1 // indirect github.com/gorilla/mux v1.7.3 github.com/jackpal/go-nat-pmp v1.0.2 // indirect @@ -33,12 +33,11 @@ require ( github.com/status-im/keycard-go v0.0.0-20191119114148-6dd40a46baa0 // indirect github.com/stretchr/testify v1.5.1 github.com/t-tiger/gorm-bulk-insert v1.3.0 - github.com/tendermint/go-amino v0.15.1 // indirect github.com/tendermint/tendermint v0.32.7 github.com/tyler-smith/go-bip39 v1.0.2 // indirect github.com/willf/pad v0.0.0-20200313202418-172aa767f2a4 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - google.golang.org/grpc v1.28.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v2 v2.2.8 // indirect + gorm.io/driver/sqlite v1.1.3 ) diff --git a/go.sum b/go.sum index b27fa74..6ff6844 100644 --- a/go.sum +++ b/go.sum @@ -268,6 +268,7 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -325,6 +326,7 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw= github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -712,6 +714,8 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= +gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 7e61b320cbadd4bcf39adb68bfd09c97bf9785ae Mon Sep 17 00:00:00 2001 From: Chih Cheng Liang Date: Wed, 4 Nov 2020 17:46:45 +0800 Subject: [PATCH 2/5] move to tests --- core/tx_test.go | 40 -------------------------- go.sum | 3 ++ tests/tx_test.go | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 40 deletions(-) delete mode 100644 core/tx_test.go create mode 100644 tests/tx_test.go diff --git a/core/tx_test.go b/core/tx_test.go deleted file mode 100644 index 898c012..0000000 --- a/core/tx_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package core - -import ( - "io/ioutil" - "log" - "os" - "testing" - - "github.com/BOPR/common" - "github.com/jinzhu/gorm" - "github.com/stretchr/testify/assert" - "gorm.io/driver/sqlite" -) - -func TestPopTx(t *testing.T) { - tmpfile, err := ioutil.TempFile("", "test.db") - if err != nil { - log.Fatal(err) - } - - defer os.Remove(tmpfile.Name()) - - db, err := gorm.Open("sqlite", sqlite.Open("gorm.db")) - logger := common.Logger.With("module", "DB") - txDB := DB{Instance: db, Logger: logger} - - tx1 := NewTx(1, 2, 1, []byte{00}, []byte{00}) - tx2 := NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) - tx3 := NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) - - txDB.InsertTx(&tx1) - txDB.InsertTx(&tx2) - txDB.InsertTx(&tx3) - - txs, err := txDB.PopTxs() - if err != nil { - t.Errorf("PopTxs error %s", err) - } - assert.Equal(t, txs, []Tx{tx2, tx3}) -} diff --git a/go.sum b/go.sum index 6ff6844..523993f 100644 --- a/go.sum +++ b/go.sum @@ -268,6 +268,7 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= @@ -714,7 +715,9 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gorm.io/driver/sqlite v1.1.3 h1:BYfdVuZB5He/u9dt4qDpZqiqDJ6KhPqs5QUqsr/Eeuc= gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= +gorm.io/gorm v1.20.1 h1:+hOwlHDqvqmBIMflemMVPLJH7tZYK4RxFDBHEfJTup0= gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/tests/tx_test.go b/tests/tx_test.go new file mode 100644 index 0000000..1250c09 --- /dev/null +++ b/tests/tx_test.go @@ -0,0 +1,74 @@ +package tests_test + +import ( + "io/ioutil" + "os" + "testing" + + "github.com/BOPR/common" + "github.com/BOPR/core" + "github.com/BOPR/migrations" + "github.com/jinzhu/gorm" + _ "github.com/jinzhu/gorm/dialects/sqlite" + "github.com/stretchr/testify/assert" +) + +func setupDB() (db core.DB, cleanup func(), err error) { + tmpfile, err := ioutil.TempFile("", "test.*.db") + println(tmpfile.Name()) + if err != nil { + return + } + + sqliteDb, err := gorm.Open("sqlite3", tmpfile.Name()) + if err != nil { + return + } + logger := common.Logger.With("module", "tests") + db = core.DB{Instance: sqliteDb, Logger: logger} + + allMigrations := migrations.GetMigrations() + m := migrations.NewGormigrate(db.Instance, migrations.DefaultOptions, allMigrations) + m.Migrate() + cleanup = func() { + println("Closing DB and removing file") + db.Close() + os.Remove(tmpfile.Name()) + } + + return db, cleanup, nil + +} + +func TestPopTx(t *testing.T) { + db, cleanup, err := setupDB() + if err != nil { + t.Errorf("setupDB error %s", err) + } + defer cleanup() + + println("Testing start") + + tx1 := core.NewTx(1, 2, 1, []byte{00}, []byte{00}) + tx2 := core.NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) + tx3 := core.NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) + + err = db.InsertTx(&tx1) + if err != nil { + t.Errorf("PopTxs error %s", err) + } + err = db.InsertTx(&tx2) + if err != nil { + t.Errorf("PopTxs error %s", err) + } + err = db.InsertTx(&tx3) + if err != nil { + t.Errorf("PopTxs error %s", err) + } + + txs, err := db.PopTxs() + if err != nil { + t.Errorf("PopTxs error %s", err) + } + assert.Equal(t, []core.Tx{tx2, tx3}, txs) +} From a03ff03c471c97f550ae5deef54d61b96bec536c Mon Sep 17 00:00:00 2001 From: Chih Cheng Liang Date: Wed, 4 Nov 2020 18:45:34 +0800 Subject: [PATCH 3/5] test pass --- tests/tx_test.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/tx_test.go b/tests/tx_test.go index 1250c09..aeed317 100644 --- a/tests/tx_test.go +++ b/tests/tx_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/BOPR/common" + "github.com/BOPR/config" "github.com/BOPR/core" "github.com/BOPR/migrations" "github.com/jinzhu/gorm" @@ -48,27 +49,31 @@ func TestPopTx(t *testing.T) { defer cleanup() println("Testing start") + var txType uint64 = 1 + config.GlobalCfg.TxsPerBatch = 2 - tx1 := core.NewTx(1, 2, 1, []byte{00}, []byte{00}) - tx2 := core.NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) - tx3 := core.NewPendingTx(1, 2, 1, []byte{00}, []byte{00}) + tx1 := core.NewTx(1, 2, txType, []byte{00}, []byte{00}) + tx2 := core.NewPendingTx(1, 2, txType, []byte{00}, []byte{01}) + tx3 := core.NewPendingTx(1, 2, txType, []byte{00}, []byte{02}) - err = db.InsertTx(&tx1) - if err != nil { + if err = db.InsertTx(&tx1); err != nil { t.Errorf("PopTxs error %s", err) } - err = db.InsertTx(&tx2) - if err != nil { + if err = db.InsertTx(&tx2); err != nil { t.Errorf("PopTxs error %s", err) } - err = db.InsertTx(&tx3) - if err != nil { + if err = db.InsertTx(&tx3); err != nil { t.Errorf("PopTxs error %s", err) } + fetchedTxType, err := db.FetchTxType() + assert.Equal(t, txType, fetchedTxType) + txs, err := db.PopTxs() if err != nil { t.Errorf("PopTxs error %s", err) } - assert.Equal(t, []core.Tx{tx2, tx3}, txs) + for i, tx := range []core.Tx{tx2, tx3} { + assert.Equal(t, tx.TxHash, txs[i].TxHash) + } } From 265139becf4267bbe777288d61623d626537acdd Mon Sep 17 00:00:00 2001 From: Chih Cheng Liang Date: Wed, 4 Nov 2020 18:50:01 +0800 Subject: [PATCH 4/5] fix go mod --- go.mod | 2 +- go.sum | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/go.mod b/go.mod index 4016f1e..569585c 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/gorilla/mux v1.7.3 github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jinzhu/gorm v1.9.12 + github.com/jinzhu/now v1.1.1 // indirect github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 // indirect github.com/kilic/bn254 v0.0.0-20200815091300-20e90d5cc039 github.com/mattn/go-isatty v0.0.12 // indirect @@ -39,5 +40,4 @@ require ( golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v2 v2.2.8 // indirect - gorm.io/driver/sqlite v1.1.3 ) diff --git a/go.sum b/go.sum index 523993f..e0137d0 100644 --- a/go.sum +++ b/go.sum @@ -83,7 +83,6 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -119,9 +118,7 @@ github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y= github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= @@ -176,7 +173,6 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -191,9 +187,6 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -327,7 +320,6 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw= github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -512,8 +504,6 @@ github.com/t-tiger/gorm-bulk-insert v1.3.0/go.mod h1:ruDlk8xDl+8sX4bA7PQuYly9YEb github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= -github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ= -github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/tendermint v0.32.7 h1:Szu5Fm1L3pvn3t4uQxPAcP+7ndZEQKgLie/yokM56rU= github.com/tendermint/tendermint v0.32.7/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ= @@ -651,15 +641,12 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -676,10 +663,7 @@ google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -715,10 +699,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gorm.io/driver/sqlite v1.1.3 h1:BYfdVuZB5He/u9dt4qDpZqiqDJ6KhPqs5QUqsr/Eeuc= -gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= -gorm.io/gorm v1.20.1 h1:+hOwlHDqvqmBIMflemMVPLJH7tZYK4RxFDBHEfJTup0= -gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From a99e6692092c9c5dcfa8943fc90527d687a41424 Mon Sep 17 00:00:00 2001 From: Chih Cheng Liang Date: Wed, 4 Nov 2020 18:52:46 +0800 Subject: [PATCH 5/5] tidy up --- tests/tx_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/tx_test.go b/tests/tx_test.go index aeed317..6b7d5e6 100644 --- a/tests/tx_test.go +++ b/tests/tx_test.go @@ -16,7 +16,6 @@ import ( func setupDB() (db core.DB, cleanup func(), err error) { tmpfile, err := ioutil.TempFile("", "test.*.db") - println(tmpfile.Name()) if err != nil { return } @@ -32,7 +31,6 @@ func setupDB() (db core.DB, cleanup func(), err error) { m := migrations.NewGormigrate(db.Instance, migrations.DefaultOptions, allMigrations) m.Migrate() cleanup = func() { - println("Closing DB and removing file") db.Close() os.Remove(tmpfile.Name()) } @@ -48,7 +46,6 @@ func TestPopTx(t *testing.T) { } defer cleanup() - println("Testing start") var txType uint64 = 1 config.GlobalCfg.TxsPerBatch = 2