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

Change service GetIndex / AddIndex to return channel instead of array #1444

Merged
merged 16 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: consolidate test params
  • Loading branch information
dirkmc committed May 9, 2023
commit 625197ce85179a4ccac67a11803a5eb1b2f99c8b
10 changes: 6 additions & 4 deletions extern/boostd-data/svc/setup_yugabyte_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ import (
"time"
)

var TestYugabyteSettings = yugabyte.DBSettings{
Hosts: []string{"127.0.0.1"},
ConnectString: "postgresql://postgres:postgres@localhost",
}

func SetupYugabyte(t *testing.T) {
ctx := context.Background()
cli, err := dockercl.NewClientWithOpts(dockercl.FromEnv)
Expand Down Expand Up @@ -68,10 +73,7 @@ func SetupYugabyte(t *testing.T) {
awaitYugabyteUp(t, time.Minute)
tlog.Info("yugabyte started")

store := yugabyte.NewStore(yugabyte.DBSettings{
Hosts: []string{"127.0.0.1"},
ConnectString: "postgresql://postgres:postgres@localhost",
})
store := yugabyte.NewStore(TestYugabyteSettings)
err = store.Start(ctx)
require.NoError(t, err)

Expand Down
12 changes: 3 additions & 9 deletions extern/boostd-data/svc/svc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/filecoin-project/boostd-data/client"
"github.com/filecoin-project/boostd-data/couchbase"
"github.com/filecoin-project/boostd-data/model"
"github.com/filecoin-project/boostd-data/yugabyte"
"github.com/filecoin-project/go-state-types/abi"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -46,11 +45,6 @@ var testCouchSettings = couchbase.DBSettings{
TestMode: true,
}

var testYugaSettings = yugabyte.DBSettings{
Hosts: []string{"127.0.0.1"},
ConnectString: "postgresql://postgres:postgres@localhost",
}

func TestService(t *testing.T) {
_ = logging.SetLogLevel("*", "debug")

Expand Down Expand Up @@ -86,7 +80,7 @@ func TestService(t *testing.T) {

SetupYugabyte(t)

bdsvc := NewYugabyte(testYugaSettings)
bdsvc := NewYugabyte(TestYugabyteSettings)

addr := "localhost:8044"
testService(ctx, t, bdsvc, addr)
Expand Down Expand Up @@ -225,7 +219,7 @@ func TestServiceFuzz(t *testing.T) {

t.Run("yugabyte", func(t *testing.T) {
SetupYugabyte(t)
bdsvc := NewYugabyte(testYugaSettings)
bdsvc := NewYugabyte(TestYugabyteSettings)

addr := "localhost:8044"
err := bdsvc.Start(ctx, addr)
Expand Down Expand Up @@ -460,7 +454,7 @@ func TestCleanup(t *testing.T) {

SetupYugabyte(t)

bdsvc := NewYugabyte(testYugaSettings)
bdsvc := NewYugabyte(TestYugabyteSettings)
testCleanup(ctx, t, bdsvc, "localhost:8044")
})
}
Expand Down
5 changes: 1 addition & 4 deletions piecedirectory/doctor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ func TestPieceDoctor(t *testing.T) {

svc.SetupYugabyte(t)

bdsvc := svc.NewYugabyte(yugabyte.DBSettings{
Hosts: []string{"127.0.0.1"},
ConnectString: "postgresql://postgres:postgres@localhost",
})
bdsvc := svc.NewYugabyte(svc.TestYugabyteSettings)

addr := "localhost:8044"
err := bdsvc.Start(ctx, addr)
Expand Down
7 changes: 1 addition & 6 deletions piecedirectory/piecedirectory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/filecoin-project/boostd-data/model"
"github.com/filecoin-project/boostd-data/svc"
"github.com/filecoin-project/boostd-data/svc/types"
"github.com/filecoin-project/boostd-data/yugabyte"
"github.com/golang/mock/gomock"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -48,11 +47,7 @@ func TestPieceDirectory(t *testing.T) {
t.Run("yugabyte", func(t *testing.T) {
svc.SetupYugabyte(t)

bdsvc := svc.NewYugabyte(yugabyte.DBSettings{
Hosts: []string{"127.0.0.1"},
ConnectString: "postgresql://postgres:postgres@localhost",
})

bdsvc := svc.NewYugabyte(svc.TestYugabyteSettings)
addr := "localhost:8044"
testPieceDirectory(ctx, t, bdsvc, addr)
})
Expand Down