From 15b2748631015efb616237d9d4d65f8c2095164d Mon Sep 17 00:00:00 2001 From: binary-ho Date: Sun, 1 Sep 2024 14:56:07 +0900 Subject: [PATCH] Set integration test to run in parallel --- server/backend/database/testcases/testcases.go | 2 +- test/integration/admin_test.go | 2 ++ test/integration/array_test.go | 6 ++++++ test/integration/client_test.go | 5 +++++ test/integration/counter_test.go | 2 ++ test/integration/document_test.go | 4 ++++ test/integration/gc_test.go | 2 ++ test/integration/health_test.go | 6 ++++++ test/integration/history_test.go | 2 ++ test/integration/housekeeping_test.go | 2 ++ test/integration/object_test.go | 8 ++++++++ test/integration/presence_test.go | 2 ++ test/integration/primitive_test.go | 2 ++ test/integration/restapi_test.go | 4 ++++ test/integration/retention_test.go | 2 ++ test/integration/server_test.go | 1 + test/integration/snapshot_test.go | 2 ++ test/integration/text_test.go | 2 ++ test/integration/tree_concurrency_test.go | 10 ++++++++++ test/integration/tree_test.go | 2 ++ test/integration/user_test.go | 2 ++ 21 files changed, 69 insertions(+), 1 deletion(-) diff --git a/server/backend/database/testcases/testcases.go b/server/backend/database/testcases/testcases.go index 1685c669e..a176dc448 100644 --- a/server/backend/database/testcases/testcases.go +++ b/server/backend/database/testcases/testcases.go @@ -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, diff --git a/test/integration/admin_test.go b/test/integration/admin_test.go index 6d77773b8..be8903f75 100644 --- a/test/integration/admin_test.go +++ b/test/integration/admin_test.go @@ -36,6 +36,8 @@ import ( ) func TestAdmin(t *testing.T) { + t.Parallel() + ctx := context.Background() adminCli, err := admin.Dial(defaultServer.RPCAddr(), admin.WithInsecure(true)) diff --git a/test/integration/array_test.go b/test/integration/array_test.go index f4935ef8a..ea5145861 100644 --- a/test/integration/array_test.go +++ b/test/integration/array_test.go @@ -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) @@ -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) @@ -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) diff --git a/test/integration/client_test.go b/test/integration/client_test.go index 3e9593d7e..6d1a9edc9 100644 --- a/test/integration/client_test.go +++ b/test/integration/client_test.go @@ -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) @@ -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() { @@ -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] @@ -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] @@ -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()) diff --git a/test/integration/counter_test.go b/test/integration/counter_test.go index 4971c88e5..7075c66c6 100644 --- a/test/integration/counter_test.go +++ b/test/integration/counter_test.go @@ -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) diff --git a/test/integration/document_test.go b/test/integration/document_test.go index 2451723d7..5986c11da 100644 --- a/test/integration/document_test.go +++ b/test/integration/document_test.go @@ -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) @@ -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() }() diff --git a/test/integration/gc_test.go b/test/integration/gc_test.go index 0713abd4f..ca1801794 100644 --- a/test/integration/gc_test.go +++ b/test/integration/gc_test.go @@ -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) diff --git a/test/integration/health_test.go b/test/integration/health_test.go index 02e5fdffc..2de1704b5 100644 --- a/test/integration/health_test.go +++ b/test/integration/health_test.go @@ -40,6 +40,8 @@ var services = []string{ } func TestRPCHealthCheck(t *testing.T) { + t.Parallel() + conn, err := grpc.Dial( defaultServer.RPCAddr(), grpc.WithTransportCredentials(insecure.NewCredentials()), @@ -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) @@ -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) diff --git a/test/integration/history_test.go b/test/integration/history_test.go index 52c059518..9eede0bd7 100644 --- a/test/integration/history_test.go +++ b/test/integration/history_test.go @@ -31,6 +31,8 @@ import ( ) func TestHistory(t *testing.T) { + t.Parallel() + clients := activeClients(t, 1) cli := clients[0] defer deactivateAndCloseClients(t, clients) diff --git a/test/integration/housekeeping_test.go b/test/integration/housekeeping_test.go index add1a9a93..b7591945b 100644 --- a/test/integration/housekeeping_test.go +++ b/test/integration/housekeeping_test.go @@ -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()) diff --git a/test/integration/object_test.go b/test/integration/object_test.go index 374953c76..1e383131e 100644 --- a/test/integration/object_test.go +++ b/test/integration/object_test.go @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/test/integration/presence_test.go b/test/integration/presence_test.go index 9f0a8e891..cef4778bf 100644 --- a/test/integration/presence_test.go +++ b/test/integration/presence_test.go @@ -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) diff --git a/test/integration/primitive_test.go b/test/integration/primitive_test.go index 747eb598a..08f58c224 100644 --- a/test/integration/primitive_test.go +++ b/test/integration/primitive_test.go @@ -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) diff --git a/test/integration/restapi_test.go b/test/integration/restapi_test.go index 18926c209..aa836d85e 100644 --- a/test/integration/restapi_test.go +++ b/test/integration/restapi_test.go @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/test/integration/retention_test.go b/test/integration/retention_test.go index a8662bc98..83a00c30c 100644 --- a/test/integration/retention_test.go +++ b/test/integration/retention_test.go @@ -40,6 +40,8 @@ import ( ) func TestRetention(t *testing.T) { + t.Parallel() + var b *background.Background patch, err := monkey.PatchInstanceMethodByName( reflect.TypeOf(b), diff --git a/test/integration/server_test.go b/test/integration/server_test.go index 30dc03d5e..23f331cb4 100644 --- a/test/integration/server_test.go +++ b/test/integration/server_test.go @@ -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()) diff --git a/test/integration/snapshot_test.go b/test/integration/snapshot_test.go index 25ea67589..f7503b8cb 100644 --- a/test/integration/snapshot_test.go +++ b/test/integration/snapshot_test.go @@ -36,6 +36,8 @@ import ( ) func TestSnapshot(t *testing.T) { + t.Parallel() + var b *background.Background patch, err := monkey.PatchInstanceMethodByName( reflect.TypeOf(b), diff --git a/test/integration/text_test.go b/test/integration/text_test.go index 890c4857f..ab66f620a 100644 --- a/test/integration/text_test.go +++ b/test/integration/text_test.go @@ -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) diff --git a/test/integration/tree_concurrency_test.go b/test/integration/tree_concurrency_test.go index b342bebcb..6416bad84 100644 --- a/test/integration/tree_concurrency_test.go +++ b/test/integration/tree_concurrency_test.go @@ -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 //

a b c

d e f

g h i

+ t.Parallel() + initialState := json.TreeNode{ Type: "root", Children: []json.TreeNode{ @@ -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 //

a b c d

e f g h

i j k l

+ t.Parallel() + initialState := json.TreeNode{ Type: "root", Children: []json.TreeNode{ @@ -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 //

a b c d

e f g h

i j k l

+ t.Parallel() + initialState := json.TreeNode{ Type: "root", Children: []json.TreeNode{ @@ -440,6 +446,8 @@ func TestTreeConcurrencyStyleStyle(t *testing.T) { // 3,6 : |----------| // 6,9 : |----------| + t.Parallel() + initialState := json.TreeNode{ Type: "root", Children: []json.TreeNode{ @@ -480,6 +488,8 @@ func TestTreeConcurrencyEditStyle(t *testing.T) { // 3,6 : |----------| // 6,9 : |----------| + t.Parallel() + initialState := json.TreeNode{ Type: "root", Children: []json.TreeNode{ diff --git a/test/integration/tree_test.go b/test/integration/tree_test.go index 54e1067c0..49024d557 100644 --- a/test/integration/tree_test.go +++ b/test/integration/tree_test.go @@ -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) diff --git a/test/integration/user_test.go b/test/integration/user_test.go index 304f6c168..7157bb49e 100644 --- a/test/integration/user_test.go +++ b/test/integration/user_test.go @@ -29,6 +29,8 @@ import ( ) func TestUser(t *testing.T) { + t.Parallel() + adminCli := helper.CreateAdminCli(t, defaultServer.RPCAddr()) defer func() { adminCli.Close() }()