Skip to content

Commit

Permalink
add random ports
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed May 25, 2023
1 parent dfbecb9 commit 0eb6101
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions extern/boostd-data/svc/svc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestService(t *testing.T) {
bdsvc, err := NewLevelDB("")
require.NoError(t, err)

testService(ctx, t, bdsvc, "localhost:8042")
testService(ctx, t, bdsvc, "localhost:0")
})

t.Run("couchbase", func(t *testing.T) {
Expand All @@ -71,7 +71,7 @@ func TestService(t *testing.T) {
SetupCouchbase(t, testCouchSettings)
bdsvc := NewCouchbase(testCouchSettings)

addr := "localhost:8043"
addr := "localhost:0"
testService(ctx, t, bdsvc, addr)
})

Expand All @@ -87,17 +87,17 @@ func TestService(t *testing.T) {

bdsvc := NewYugabyte(TestYugabyteSettings)

addr := "localhost:8044"
addr := "localhost:0"
testService(ctx, t, bdsvc, addr)
})
}

func testService(ctx context.Context, t *testing.T, bdsvc *Service, addr string) {
err := bdsvc.Start(ctx, addr)
ln, err := bdsvc.Start(ctx, addr)
require.NoError(t, err)

cl := client.NewStore()
err = cl.Dial(context.Background(), fmt.Sprintf("ws://%s", addr))
err = cl.Dial(context.Background(), fmt.Sprintf("ws://%s", ln))
require.NoError(t, err)
defer cl.Close(ctx)

Expand Down Expand Up @@ -201,13 +201,13 @@ func TestServiceFuzz(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

t.Run("level db", func(t *testing.T) {
t.Run("leveldb", func(t *testing.T) {
bdsvc, err := NewLevelDB("")
require.NoError(t, err)
addr := "localhost:8042"
err = bdsvc.Start(ctx, addr)
addr := "localhost:0"
ln, err := bdsvc.Start(ctx, addr)
require.NoError(t, err)
testServiceFuzz(ctx, t, addr)
testServiceFuzz(ctx, t, ln.String())
})

t.Run("couchbase", func(t *testing.T) {
Expand All @@ -216,21 +216,21 @@ func TestServiceFuzz(t *testing.T) {
t.Skip()
SetupCouchbase(t, testCouchSettings)
bdsvc := NewCouchbase(testCouchSettings)
addr := "localhost:8043"
err := bdsvc.Start(ctx, addr)
addr := "localhost:0"
ln, err := bdsvc.Start(ctx, addr)
require.NoError(t, err)
testServiceFuzz(ctx, t, addr)
testServiceFuzz(ctx, t, ln.String())
})

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

addr := "localhost:8044"
err := bdsvc.Start(ctx, addr)
addr := "localhost:0"
ln, err := bdsvc.Start(ctx, addr)
require.NoError(t, err)

testServiceFuzz(ctx, t, addr)
testServiceFuzz(ctx, t, ln.String())
})
}

Expand Down Expand Up @@ -458,7 +458,7 @@ func TestCleanup(t *testing.T) {
t.Run("level db", func(t *testing.T) {
bdsvc, err := NewLevelDB("")
require.NoError(t, err)
testCleanup(ctx, t, bdsvc, "localhost:8042")
testCleanup(ctx, t, bdsvc, "localhost:0")
})

t.Run("couchbase", func(t *testing.T) {
Expand All @@ -467,7 +467,7 @@ func TestCleanup(t *testing.T) {
t.Skip()
SetupCouchbase(t, testCouchSettings)
bdsvc := NewCouchbase(testCouchSettings)
testCleanup(ctx, t, bdsvc, "localhost:8043")
testCleanup(ctx, t, bdsvc, "localhost:0")
})

t.Run("yugabyte", func(t *testing.T) {
Expand All @@ -479,7 +479,7 @@ func TestCleanup(t *testing.T) {
SetupYugabyte(t)

bdsvc := NewYugabyte(TestYugabyteSettings)
testCleanup(ctx, t, bdsvc, "localhost:8044")
testCleanup(ctx, t, bdsvc, "localhost:0")
})
}

Expand Down

0 comments on commit 0eb6101

Please sign in to comment.