mirror of https://github.com/etcd-io/bbolt.git
Recursive checker: Final touches.
Signed-off-by: Piotr Tabor <ptab@google.com>pull/225/head
parent
710c33fe89
commit
ee27a544ca
2
go.mod
2
go.mod
|
@ -10,7 +10,5 @@ require (
|
|||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/mod v0.7.0 // indirect
|
||||
golang.org/x/tools v0.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -10,12 +10,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
|
||||
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4=
|
||||
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -2,12 +2,14 @@ package tests_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
bolt "go.etcd.io/bbolt"
|
||||
"go.etcd.io/bbolt/internal/btesting"
|
||||
"go.etcd.io/bbolt/internal/guts_cli"
|
||||
"go.etcd.io/bbolt/internal/surgeon"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTx_RecursivelyCheckPages_MisplacedPage(t *testing.T) {
|
||||
|
@ -19,13 +21,13 @@ func TestTx_RecursivelyCheckPages_MisplacedPage(t *testing.T) {
|
|||
))
|
||||
assert.NoError(t, db.Close())
|
||||
|
||||
navigator := surgeon.NewXRay(db.Path())
|
||||
xRay := surgeon.NewXRay(db.Path())
|
||||
|
||||
path1, err := navigator.FindPathToPagesWithKey([]byte("0451"))
|
||||
path1, err := xRay.FindPathsToKey([]byte("0451"))
|
||||
assert.NoError(t, err, "Cannot find page that contains key:'0451'")
|
||||
assert.Len(t, path1, 1, "Expected only one page that contains key:'0451'")
|
||||
|
||||
path2, err := navigator.FindPathToPagesWithKey([]byte("7563"))
|
||||
path2, err := xRay.FindPathsToKey([]byte("7563"))
|
||||
assert.NoError(t, err, "Cannot find page that contains key:'7563'")
|
||||
assert.Len(t, path2, 1, "Expected only one page that contains key:'7563'")
|
||||
|
||||
|
@ -56,9 +58,9 @@ func TestTx_RecursivelyCheckPages_CorruptedLeaf(t *testing.T) {
|
|||
))
|
||||
assert.NoError(t, db.Close())
|
||||
|
||||
navigator := surgeon.NewXRay(db.Path())
|
||||
xray := surgeon.NewXRay(db.Path())
|
||||
|
||||
path1, err := navigator.FindPathToPagesWithKey([]byte("0451"))
|
||||
path1, err := xray.FindPathsToKey([]byte("0451"))
|
||||
assert.NoError(t, err, "Cannot find page that contains key:'0451'")
|
||||
assert.Len(t, path1, 1, "Expected only one page that contains key:'0451'")
|
||||
|
||||
|
|
|
@ -10,3 +10,4 @@ XTESTGOFILES=$(${GO_CMD} list --f "{{with \$d:=.}}{{range .XTestGoFiles}}{{\$d.
|
|||
echo "${GOFILES}" "${TESTGOFILES}" "${XTESTGOFILES}"| xargs -n 100 go run golang.org/x/tools/cmd/goimports@latest -w -local go.etcd.io
|
||||
|
||||
go fmt ./...
|
||||
go mod tidy
|
||||
|
|
|
@ -48,8 +48,7 @@ func TestTx_Check_ReadOnly(t *testing.T) {
|
|||
numChecks := 2
|
||||
errc := make(chan error, numChecks)
|
||||
check := func() {
|
||||
err, _ := <-tx.Check(bolt.HexKeyValueStringer())
|
||||
errc <- err
|
||||
errc <- <-tx.Check(bolt.HexKeyValueStringer())
|
||||
}
|
||||
// Ensure the freelist is not reloaded and does not race.
|
||||
for i := 0; i < numChecks; i++ {
|
||||
|
|
Loading…
Reference in New Issue