Skip to content

Commit

Permalink
Set integration test to run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-ho committed Sep 1, 2024
1 parent 7b43567 commit 15b2748
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/backend/database/testcases/testcases.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const (
)

// RunFindDocInfoTest runs the FindDocInfo test for the given db.
// TODO(binary-ho) : temporary comment for measure CI test time
// TODO(binary-ho): temporary comment for measure CI test time
func RunFindDocInfoTest(
t *testing.T,
db database.Database,
Expand Down
2 changes: 2 additions & 0 deletions test/integration/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import (
)

func TestAdmin(t *testing.T) {
t.Parallel()

ctx := context.Background()

adminCli, err := admin.Dial(defaultServer.RPCAddr(), admin.WithInsecure(true))
Expand Down
6 changes: 6 additions & 0 deletions test/integration/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
)

func TestArray(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down Expand Up @@ -328,6 +330,8 @@ func TestArray(t *testing.T) {
}

func TestArraySetTypeGuard(t *testing.T) {
t.Parallel()

clients := activeClients(t, 1)
c1 := clients[0]
defer deactivateAndCloseClients(t, clients)
Expand Down Expand Up @@ -385,6 +389,8 @@ func TestArraySetTypeGuard(t *testing.T) {
}

func TestArraySet(t *testing.T) {
t.Parallel()

clients := activeClients(t, 1)
c1 := clients[0]
defer deactivateAndCloseClients(t, clients)
Expand Down
5 changes: 5 additions & 0 deletions test/integration/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (

func TestClient(t *testing.T) {
t.Run("dial and close test", func(t *testing.T) {
t.Parallel()
cli, err := client.Dial(defaultServer.RPCAddr())
assert.NoError(t, err)

Expand All @@ -47,6 +48,7 @@ func TestClient(t *testing.T) {
})

t.Run("activate/deactivate test", func(t *testing.T) {
t.Parallel()
cli, err := client.Dial(defaultServer.RPCAddr())
assert.NoError(t, err)
defer func() {
Expand Down Expand Up @@ -76,6 +78,7 @@ func TestClient(t *testing.T) {
})

t.Run("sync option with multiple clients test", func(t *testing.T) {
t.Parallel()
clients := activeClients(t, 3)
defer deactivateAndCloseClients(t, clients)
c1, c2, c3 := clients[0], clients[1], clients[2]
Expand Down Expand Up @@ -131,6 +134,7 @@ func TestClient(t *testing.T) {
})

t.Run("sync option with mixed mode test", func(t *testing.T) {
t.Parallel()
clients := activeClients(t, 1)
defer deactivateAndCloseClients(t, clients)
cli := clients[0]
Expand Down Expand Up @@ -176,6 +180,7 @@ func TestClient(t *testing.T) {
})

t.Run("deactivated client's stream test", func(t *testing.T) {
t.Parallel()
ctx := context.Background()

c1, err := client.Dial(defaultServer.RPCAddr())
Expand Down
2 changes: 2 additions & 0 deletions test/integration/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
)

func TestCounter(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down
4 changes: 4 additions & 0 deletions test/integration/document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import (
)

func TestDocument(t *testing.T) {
t.Parallel()

clients := activeClients(t, 3)
c1, c2, c3 := clients[0], clients[1], clients[2]
defer deactivateAndCloseClients(t, clients)
Expand Down Expand Up @@ -689,6 +691,8 @@ func TestDocument(t *testing.T) {
}

func TestDocumentWithProjects(t *testing.T) {
t.Parallel()

ctx := context.Background()
adminCli := helper.CreateAdminCli(t, defaultServer.RPCAddr())
defer func() { adminCli.Close() }()
Expand Down
2 changes: 2 additions & 0 deletions test/integration/gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import (
)

func TestGarbageCollection(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down
6 changes: 6 additions & 0 deletions test/integration/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var services = []string{
}

func TestRPCHealthCheck(t *testing.T) {
t.Parallel()

conn, err := grpc.Dial(
defaultServer.RPCAddr(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
Expand Down Expand Up @@ -79,6 +81,8 @@ func TestRPCHealthCheck(t *testing.T) {
}

func TestHTTPGETHealthCheck(t *testing.T) {
t.Parallel()

// check default service
t.Run("Service: default", func(t *testing.T) {
resp, err := http.Get("http://" + defaultServer.RPCAddr() + httphealth.HealthV1ServiceName)
Expand Down Expand Up @@ -125,6 +129,8 @@ func TestHTTPGETHealthCheck(t *testing.T) {
}

func TestHTTPHEADHealthCheck(t *testing.T) {
t.Parallel()

// check default service
t.Run("Service: default", func(t *testing.T) {
resp, err := http.Head("http://" + defaultServer.RPCAddr() + httphealth.HealthV1ServiceName)
Expand Down
2 changes: 2 additions & 0 deletions test/integration/history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
)

func TestHistory(t *testing.T) {
t.Parallel()

clients := activeClients(t, 1)
cli := clients[0]
defer deactivateAndCloseClients(t, clients)
Expand Down
2 changes: 2 additions & 0 deletions test/integration/housekeeping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func setupBackend(t *testing.T) *backend.Backend {
}

func TestHousekeeping(t *testing.T) {
t.Parallel()

be := setupBackend(t)
defer func() {
assert.NoError(t, be.Shutdown())
Expand Down
8 changes: 8 additions & 0 deletions test/integration/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
)

func TestObject(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down Expand Up @@ -359,6 +361,8 @@ func TestObject(t *testing.T) {
}

func TestObjectTypeGuard(t *testing.T) {
t.Parallel()

clients := activeClients(t, 1)
c1 := clients[0]
defer deactivateAndCloseClients(t, clients)
Expand Down Expand Up @@ -419,6 +423,8 @@ func TestObjectTypeGuard(t *testing.T) {
}

func TestObjectSetCycle(t *testing.T) {
t.Parallel()

clients := activeClients(t, 1)
c1 := clients[0]
defer deactivateAndCloseClients(t, clients)
Expand Down Expand Up @@ -481,6 +487,8 @@ func TestObjectSetCycle(t *testing.T) {
}

func TestObjectSet(t *testing.T) {
t.Parallel()

clients := activeClients(t, 1)
c1 := clients[0]
defer deactivateAndCloseClients(t, clients)
Expand Down
2 changes: 2 additions & 0 deletions test/integration/presence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import (
)

func TestPresence(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down
2 changes: 2 additions & 0 deletions test/integration/primitive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
)

func TestPrimitive(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down
4 changes: 4 additions & 0 deletions test/integration/restapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type documentSummary struct {

func TestRESTAPI(t *testing.T) {
t.Run("document retrieval test", func(t *testing.T) {
t.Parallel()
project, docs := helper.CreateProjectAndDocuments(t, defaultServer, 3)
res := post(
t,
Expand All @@ -58,6 +59,7 @@ func TestRESTAPI(t *testing.T) {
})

t.Run("bulk document retrieval test", func(t *testing.T) {
t.Parallel()
project, docs := helper.CreateProjectAndDocuments(t, defaultServer, 3)
res := post(
t,
Expand All @@ -72,6 +74,7 @@ func TestRESTAPI(t *testing.T) {
})

t.Run("list documents test", func(t *testing.T) {
t.Parallel()
project, _ := helper.CreateProjectAndDocuments(t, defaultServer, 3)
res := post(
t,
Expand All @@ -86,6 +89,7 @@ func TestRESTAPI(t *testing.T) {
})

t.Run("search documents test", func(t *testing.T) {
t.Parallel()
project, docs := helper.CreateProjectAndDocuments(t, defaultServer, 3)
res := post(
t,
Expand Down
2 changes: 2 additions & 0 deletions test/integration/retention_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import (
)

func TestRetention(t *testing.T) {
t.Parallel()

var b *background.Background
patch, err := monkey.PatchInstanceMethodByName(
reflect.TypeOf(b),
Expand Down
1 change: 1 addition & 0 deletions test/integration/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

func TestServer(t *testing.T) {
t.Run("closing WatchDocument stream on server shutdown test", func(t *testing.T) {
t.Parallel()
ctx := context.Background()
svr := helper.TestServer()
assert.NoError(t, svr.Start())
Expand Down
2 changes: 2 additions & 0 deletions test/integration/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import (
)

func TestSnapshot(t *testing.T) {
t.Parallel()

var b *background.Background
patch, err := monkey.PatchInstanceMethodByName(
reflect.TypeOf(b),
Expand Down
2 changes: 2 additions & 0 deletions test/integration/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
)

func TestText(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down
10 changes: 10 additions & 0 deletions test/integration/tree_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ func TestTreeConcurrencyEditEdit(t *testing.T) {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// <root> <p> a b c </p> <p> d e f </p> <p> g h i </p> </root>

t.Parallel()

initialState := json.TreeNode{
Type: "root",
Children: []json.TreeNode{
Expand Down Expand Up @@ -330,6 +332,8 @@ func TestTreeConcurrencySplitSplit(t *testing.T) {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// <root> <p> <p> <p> <p> a b c d </p> <p> e f g h </p> </p> <p> i j k l </p> </p> </p> </root>

t.Parallel()

initialState := json.TreeNode{
Type: "root",
Children: []json.TreeNode{
Expand Down Expand Up @@ -377,6 +381,8 @@ func TestTreeConcurrencySplitEdit(t *testing.T) {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
// <root> <p> <p> <p> a b c d </p> <p> e f g h </p> </p> <p> i j k l </p> </p> </root>

t.Parallel()

initialState := json.TreeNode{
Type: "root",
Children: []json.TreeNode{
Expand Down Expand Up @@ -440,6 +446,8 @@ func TestTreeConcurrencyStyleStyle(t *testing.T) {
// 3,6 : |----------|
// 6,9 : |----------|

t.Parallel()

initialState := json.TreeNode{
Type: "root",
Children: []json.TreeNode{
Expand Down Expand Up @@ -480,6 +488,8 @@ func TestTreeConcurrencyEditStyle(t *testing.T) {
// 3,6 : |----------|
// 6,9 : |----------|

t.Parallel()

initialState := json.TreeNode{
Type: "root",
Children: []json.TreeNode{
Expand Down
2 changes: 2 additions & 0 deletions test/integration/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
)

func TestTree(t *testing.T) {
t.Parallel()

clients := activeClients(t, 2)
c1, c2 := clients[0], clients[1]
defer deactivateAndCloseClients(t, clients)
Expand Down
2 changes: 2 additions & 0 deletions test/integration/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
)

func TestUser(t *testing.T) {
t.Parallel()

adminCli := helper.CreateAdminCli(t, defaultServer.RPCAddr())
defer func() { adminCli.Close() }()

Expand Down

0 comments on commit 15b2748

Please sign in to comment.