Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: separate yugabyte / leveldb tests for easier local testing #1553

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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