Skip to content

Commit

Permalink
refactor: separate yugabyte / leveldb tests for easier local testing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc authored Jul 3, 2023
1 parent 16c6310 commit 497472d
Show file tree
Hide file tree
Showing 8 changed files with 578 additions and 540 deletions.
7 changes: 7 additions & 0 deletions extern/boostd-data/svc/setup_yugabyte_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ var TestYugabyteSettings = yugabyte.DBSettings{
ConnectString: "postgresql://postgres:postgres@yugabyte:5433",
}

// Use when testing against a local yugabyte instance.
// Warning: This will delete all tables in the local yugabyte instance.
var TestYugabyteSettingsLocal = yugabyte.DBSettings{
Hosts: []string{"localhost"},
ConnectString: "postgresql://postgres:postgres@localhost:5433",
}

func SetupYugabyte(t *testing.T) {
ctx := context.Background()

Expand Down
19 changes: 0 additions & 19 deletions extern/boostd-data/svc/svc_size_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/filecoin-project/boostd-data/model"
"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2"
"github.com/ipld/go-car/v2/index"
"github.com/multiformats/go-multihash"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -122,20 +120,3 @@ func generateRandomCid(baseCid []byte) (cid.Cid, error) {

return c, nil
}

func toEntries(idx index.Index) (map[string]uint64, bool) {
it, ok := idx.(index.IterableIndex)
if !ok {
return nil, false
}

entries := make(map[string]uint64)
err := it.ForEach(func(mh multihash.Multihash, o uint64) error {
entries[mh.String()] = o
return nil
})
if err != nil {
return nil, false
}
return entries, true
}
Loading

0 comments on commit 497472d

Please sign in to comment.