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 and LexLuthr committed Jul 20, 2023
1 parent 8cb424e commit 48e9eae
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 924 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 48e9eae

Please sign in to comment.