diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5ef29432..1db5358eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,4 +114,4 @@ jobs: run: sleep 30s - name: Run the tests with shard tag - run: go test -tags shard -race -v ./... + run: go test -tags shard -race -v ./test/shard/... diff --git a/server/backend/database/memory/housekeeping_test.go b/server/backend/database/memory/housekeeping_test.go index 5c1aeaeb0..d8c0ef894 100644 --- a/server/backend/database/memory/housekeeping_test.go +++ b/server/backend/database/memory/housekeeping_test.go @@ -43,7 +43,12 @@ func TestHousekeeping(t *testing.T) { userInfo, err := memdb.CreateUserInfo(ctx, "test", "test") assert.NoError(t, err) - project, err := memdb.CreateProjectInfo(ctx, database.DefaultProjectName, userInfo.ID, clientDeactivateThreshold) + project, err := memdb.CreateProjectInfo( + ctx, + database.DefaultProjectName, + userInfo.Username, + clientDeactivateThreshold, + ) assert.NoError(t, err) yesterday := gotime.Now().Add(-24 * gotime.Hour) @@ -123,7 +128,7 @@ func createDBandProjects(t *testing.T) (*memory.DB, []*database.ProjectInfo) { projects := make([]*database.ProjectInfo, 0) for i := 0; i < 10; i++ { - p, err := memdb.CreateProjectInfo(ctx, fmt.Sprintf("%d project", i), userInfo.ID, clientDeactivateThreshold) + p, err := memdb.CreateProjectInfo(ctx, fmt.Sprintf("%d project", i), userInfo.Username, clientDeactivateThreshold) assert.NoError(t, err) projects = append(projects, p) diff --git a/test/bench/push_pull_bench_test.go b/test/bench/push_pull_bench_test.go index cab46ea8d..b822d3152 100644 --- a/test/bench/push_pull_bench_test.go +++ b/test/bench/push_pull_bench_test.go @@ -25,6 +25,7 @@ import ( gotime "time" "github.com/stretchr/testify/assert" + "github.com/yorkie-team/yorkie/api/converter" "github.com/yorkie-team/yorkie/api/types" "github.com/yorkie-team/yorkie/pkg/document" @@ -89,7 +90,7 @@ func setUpClientsAndDocs( assert.NoError(b, err) docInfo, err := be.DB.FindDocInfoByKeyAndOwner(ctx, database.DefaultProjectID, clientInfo.ID, docKey, true) assert.NoError(b, err) - assert.NoError(b, clientInfo.AttachDocument(docInfo.ID)) + assert.NoError(b, clientInfo.AttachDocument(docInfo.Key, docInfo.ID)) assert.NoError(b, be.DB.UpdateClientInfoAfterPushPull(ctx, clientInfo, docInfo)) bytesID, _ := clientInfo.ID.Bytes() @@ -136,7 +137,7 @@ func benchmarkPushChanges( docKey := getDocKey(b, i) clientInfos, docID, docs := setUpClientsAndDocs(ctx, 1, docKey, b, be) pack := createChangePack(changeCnt, docs[0], b) - docInfo, err := documents.FindDocInfo(ctx, be, project, docID) + docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID) assert.NoError(b, err) b.StartTimer() @@ -161,12 +162,12 @@ func benchmarkPullChanges( pushPack := createChangePack(changeCnt, pusherDoc, b) pullPack := createChangePack(0, pullerDoc, b) - docInfo, err := documents.FindDocInfo(ctx, be, project, docID) + docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID) assert.NoError(b, err) _, err = packs.PushPull(ctx, be, project, pusherClientInfo, docInfo, pushPack, types.SyncModePushPull) assert.NoError(b, err) - docInfo, err = documents.FindDocInfo(ctx, be, project, docID) + docInfo, err = documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID) assert.NoError(b, err) b.StartTimer() @@ -192,7 +193,7 @@ func benchmarkPushSnapshots( for j := 0; j < snapshotCnt; j++ { b.StopTimer() pushPack := createChangePack(changeCnt, docs[0], b) - docInfo, err := documents.FindDocInfo(ctx, be, project, docID) + docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID) assert.NoError(b, err) b.StartTimer() @@ -226,12 +227,12 @@ func benchmarkPullSnapshot( pushPack := createChangePack(changeCnt, pusherDoc, b) pullPack := createChangePack(0, pullerDoc, b) - docInfo, err := documents.FindDocInfo(ctx, be, project, docID) + docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID) assert.NoError(b, err) _, err = packs.PushPull(ctx, be, project, pusherClientInfo, docInfo, pushPack, types.SyncModePushPull) assert.NoError(b, err) - docInfo, err = documents.FindDocInfo(ctx, be, project, docID) + docInfo, err = documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID) assert.NoError(b, err) b.StartTimer() diff --git a/test/integration/retention_test.go b/test/integration/retention_test.go index fc36fa2df..70732062c 100644 --- a/test/integration/retention_test.go +++ b/test/integration/retention_test.go @@ -191,6 +191,7 @@ func TestRetention(t *testing.T) { changes, err := mongoCli.FindChangesBetweenServerSeqs( ctx, + docInfo.Key, docInfo.ID, change.InitialServerSeq, change.MaxServerSeq, @@ -229,6 +230,7 @@ func TestRetention(t *testing.T) { changes, err = mongoCli.FindChangesBetweenServerSeqs( ctx, + docInfo.Key, docInfo.ID, change.InitialServerSeq, change.MaxServerSeq,