diff --git a/store/test/activity_test.go b/store/test/activity_test.go index 879856289..20eecca52 100644 --- a/store/test/activity_test.go +++ b/store/test/activity_test.go @@ -11,6 +11,7 @@ import ( ) func TestActivityStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -34,6 +35,7 @@ func TestActivityStore(t *testing.T) { } func TestActivityGetByID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -63,6 +65,7 @@ func TestActivityGetByID(t *testing.T) { } func TestActivityListMultiple(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -101,6 +104,7 @@ func TestActivityListMultiple(t *testing.T) { } func TestActivityListByType(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -136,6 +140,7 @@ func TestActivityListByType(t *testing.T) { } func TestActivityPayloadMemoComment(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -172,6 +177,7 @@ func TestActivityPayloadMemoComment(t *testing.T) { } func TestActivityEmptyPayload(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -197,6 +203,7 @@ func TestActivityEmptyPayload(t *testing.T) { } func TestActivityLevel(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -221,6 +228,7 @@ func TestActivityLevel(t *testing.T) { } func TestActivityCreatorID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user1, err := createTestingHostUser(ctx, ts) @@ -257,6 +265,7 @@ func TestActivityCreatorID(t *testing.T) { } func TestActivityCreatedTs(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -280,6 +289,7 @@ func TestActivityCreatedTs(t *testing.T) { } func TestActivityListEmpty(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -292,6 +302,7 @@ func TestActivityListEmpty(t *testing.T) { } func TestActivityListWithIDAndType(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -319,6 +330,7 @@ func TestActivityListWithIDAndType(t *testing.T) { } func TestActivityPayloadComplexMemoComment(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) diff --git a/store/test/attachment_filter_test.go b/store/test/attachment_filter_test.go index 3ae64b024..a2f6c6af3 100644 --- a/store/test/attachment_filter_test.go +++ b/store/test/attachment_filter_test.go @@ -13,6 +13,7 @@ import ( // ============================================================================= func TestAttachmentFilterFilenameContains(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -35,6 +36,7 @@ func TestAttachmentFilterFilenameContains(t *testing.T) { } func TestAttachmentFilterFilenameSpecialCharacters(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -51,6 +53,7 @@ func TestAttachmentFilterFilenameSpecialCharacters(t *testing.T) { } func TestAttachmentFilterFilenameUnicode(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -67,6 +70,7 @@ func TestAttachmentFilterFilenameUnicode(t *testing.T) { // ============================================================================= func TestAttachmentFilterMimeTypeEquals(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -86,6 +90,7 @@ func TestAttachmentFilterMimeTypeEquals(t *testing.T) { } func TestAttachmentFilterMimeTypeNotEquals(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -98,6 +103,7 @@ func TestAttachmentFilterMimeTypeNotEquals(t *testing.T) { } func TestAttachmentFilterMimeTypeInList(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -121,6 +127,7 @@ func TestAttachmentFilterMimeTypeInList(t *testing.T) { // ============================================================================= func TestAttachmentFilterCreateTimeComparison(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -141,6 +148,7 @@ func TestAttachmentFilterCreateTimeComparison(t *testing.T) { } func TestAttachmentFilterCreateTimeWithNow(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -156,6 +164,7 @@ func TestAttachmentFilterCreateTimeWithNow(t *testing.T) { } func TestAttachmentFilterCreateTimeArithmetic(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -175,6 +184,7 @@ func TestAttachmentFilterCreateTimeArithmetic(t *testing.T) { } func TestAttachmentFilterAllComparisonOperators(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -203,6 +213,7 @@ func TestAttachmentFilterAllComparisonOperators(t *testing.T) { // ============================================================================= func TestAttachmentFilterMemoIdEquals(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContextWithUser(t) defer tc.Close() @@ -218,6 +229,7 @@ func TestAttachmentFilterMemoIdEquals(t *testing.T) { } func TestAttachmentFilterMemoIdNotEquals(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContextWithUser(t) defer tc.Close() @@ -238,6 +250,7 @@ func TestAttachmentFilterMemoIdNotEquals(t *testing.T) { // ============================================================================= func TestAttachmentFilterLogicalAnd(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -251,6 +264,7 @@ func TestAttachmentFilterLogicalAnd(t *testing.T) { } func TestAttachmentFilterLogicalOr(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -263,6 +277,7 @@ func TestAttachmentFilterLogicalOr(t *testing.T) { } func TestAttachmentFilterLogicalNot(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -275,6 +290,7 @@ func TestAttachmentFilterLogicalNot(t *testing.T) { } func TestAttachmentFilterComplexLogical(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -291,6 +307,7 @@ func TestAttachmentFilterComplexLogical(t *testing.T) { // ============================================================================= func TestAttachmentFilterMultipleFilters(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -310,6 +327,7 @@ func TestAttachmentFilterMultipleFilters(t *testing.T) { // ============================================================================= func TestAttachmentFilterNoMatches(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() @@ -320,6 +338,7 @@ func TestAttachmentFilterNoMatches(t *testing.T) { } func TestAttachmentFilterNullMemoId(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContextWithUser(t) defer tc.Close() @@ -343,6 +362,7 @@ func TestAttachmentFilterNullMemoId(t *testing.T) { } func TestAttachmentFilterEmptyFilename(t *testing.T) { + t.Parallel() tc := NewAttachmentFilterTestContext(t) defer tc.Close() diff --git a/store/test/attachment_test.go b/store/test/attachment_test.go index 1886f75d5..12cb23be2 100644 --- a/store/test/attachment_test.go +++ b/store/test/attachment_test.go @@ -12,6 +12,7 @@ import ( ) func TestAttachmentStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) _, err := ts.CreateAttachment(ctx, &store.Attachment{ @@ -64,6 +65,7 @@ func TestAttachmentStore(t *testing.T) { } func TestAttachmentStoreWithFilter(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -123,6 +125,7 @@ func TestAttachmentStoreWithFilter(t *testing.T) { } func TestAttachmentUpdate(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -153,6 +156,7 @@ func TestAttachmentUpdate(t *testing.T) { } func TestAttachmentGetByUID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -183,6 +187,7 @@ func TestAttachmentGetByUID(t *testing.T) { } func TestAttachmentListWithPagination(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -222,6 +227,7 @@ func TestAttachmentListWithPagination(t *testing.T) { } func TestAttachmentInvalidUID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) diff --git a/store/test/containers.go b/store/test/containers.go index 38959ec2a..f436782a5 100644 --- a/store/test/containers.go +++ b/store/test/containers.go @@ -49,6 +49,7 @@ var ( mysqlBaseDSN string postgresBaseDSN string dbCounter atomic.Int64 + dbCreationMutex sync.Mutex // Protects database creation operations // Network for container communication. testDockerNetwork *testcontainers.DockerNetwork @@ -116,6 +117,10 @@ func GetMySQLDSN(t *testing.T) string { t.Fatal("MySQL container failed to start in a previous test") } + // Serialize database creation to avoid "table already exists" race conditions + dbCreationMutex.Lock() + defer dbCreationMutex.Unlock() + // Create a fresh database for this test dbName := fmt.Sprintf("memos_test_%d", dbCounter.Add(1)) db, err := sql.Open("mysql", mysqlBaseDSN) @@ -208,6 +213,10 @@ func GetPostgresDSN(t *testing.T) string { t.Fatal("PostgreSQL container failed to start in a previous test") } + // Serialize database creation to avoid "table already exists" race conditions + dbCreationMutex.Lock() + defer dbCreationMutex.Unlock() + // Create a fresh database for this test dbName := fmt.Sprintf("memos_test_%d", dbCounter.Add(1)) db, err := sql.Open("postgres", postgresBaseDSN) diff --git a/store/test/idp_test.go b/store/test/idp_test.go index 5df4da9e8..8f2f1958b 100644 --- a/store/test/idp_test.go +++ b/store/test/idp_test.go @@ -11,6 +11,7 @@ import ( ) func TestIdentityProviderStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) createdIDP, err := ts.CreateIdentityProvider(ctx, &storepb.IdentityProvider{ @@ -60,6 +61,7 @@ func TestIdentityProviderStore(t *testing.T) { } func TestIdentityProviderGetByID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -84,6 +86,7 @@ func TestIdentityProviderGetByID(t *testing.T) { } func TestIdentityProviderListMultiple(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -104,6 +107,7 @@ func TestIdentityProviderListMultiple(t *testing.T) { } func TestIdentityProviderListByID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -123,6 +127,7 @@ func TestIdentityProviderListByID(t *testing.T) { } func TestIdentityProviderUpdateName(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -149,6 +154,7 @@ func TestIdentityProviderUpdateName(t *testing.T) { } func TestIdentityProviderUpdateIdentifierFilter(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -175,6 +181,7 @@ func TestIdentityProviderUpdateIdentifierFilter(t *testing.T) { } func TestIdentityProviderUpdateConfig(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -218,6 +225,7 @@ func TestIdentityProviderUpdateConfig(t *testing.T) { } func TestIdentityProviderUpdateMultipleFields(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -241,6 +249,7 @@ func TestIdentityProviderUpdateMultipleFields(t *testing.T) { } func TestIdentityProviderDelete(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -260,6 +269,7 @@ func TestIdentityProviderDelete(t *testing.T) { } func TestIdentityProviderDeleteNotAffectOthers(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -288,6 +298,7 @@ func TestIdentityProviderDeleteNotAffectOthers(t *testing.T) { } func TestIdentityProviderOAuth2ConfigScopes(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -326,6 +337,7 @@ func TestIdentityProviderOAuth2ConfigScopes(t *testing.T) { } func TestIdentityProviderFieldMapping(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -364,6 +376,7 @@ func TestIdentityProviderFieldMapping(t *testing.T) { } func TestIdentityProviderIdentifierFilterPatterns(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) diff --git a/store/test/inbox_test.go b/store/test/inbox_test.go index e3205099d..8af2c7082 100644 --- a/store/test/inbox_test.go +++ b/store/test/inbox_test.go @@ -11,6 +11,7 @@ import ( ) func TestInboxStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -54,6 +55,7 @@ func TestInboxStore(t *testing.T) { } func TestInboxListByID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -83,6 +85,7 @@ func TestInboxListByID(t *testing.T) { } func TestInboxListBySenderID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user1, err := createTestingHostUser(ctx, ts) @@ -125,6 +128,7 @@ func TestInboxListBySenderID(t *testing.T) { } func TestInboxListByStatus(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -168,6 +172,7 @@ func TestInboxListByStatus(t *testing.T) { } func TestInboxListByMessageType(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -203,6 +208,7 @@ func TestInboxListByMessageType(t *testing.T) { } func TestInboxListPagination(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -254,6 +260,7 @@ func TestInboxListPagination(t *testing.T) { } func TestInboxListCombinedFilters(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user1, err := createTestingHostUser(ctx, ts) @@ -316,6 +323,7 @@ func TestInboxListCombinedFilters(t *testing.T) { } func TestInboxMessagePayload(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -347,6 +355,7 @@ func TestInboxMessagePayload(t *testing.T) { } func TestInboxUpdateStatus(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -380,6 +389,7 @@ func TestInboxUpdateStatus(t *testing.T) { } func TestInboxListByMessageTypeMultipleTypes(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -436,6 +446,7 @@ func TestInboxListByMessageTypeMultipleTypes(t *testing.T) { } func TestInboxMessageTypeFilterWithPayload(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -481,6 +492,7 @@ func TestInboxMessageTypeFilterWithPayload(t *testing.T) { } func TestInboxMessageTypeFilterWithStatusAndPagination(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -538,6 +550,7 @@ func TestInboxMessageTypeFilterWithStatusAndPagination(t *testing.T) { } func TestInboxMultipleReceivers(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user1, err := createTestingHostUser(ctx, ts) diff --git a/store/test/instance_setting_test.go b/store/test/instance_setting_test.go index 9ab072753..0b99c6bf2 100644 --- a/store/test/instance_setting_test.go +++ b/store/test/instance_setting_test.go @@ -11,6 +11,7 @@ import ( ) func TestInstanceSettingV1Store(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) instanceSetting, err := ts.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{ @@ -31,6 +32,7 @@ func TestInstanceSettingV1Store(t *testing.T) { } func TestInstanceSettingGetNonExistent(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -45,6 +47,7 @@ func TestInstanceSettingGetNonExistent(t *testing.T) { } func TestInstanceSettingUpsertUpdate(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -88,6 +91,7 @@ func TestInstanceSettingUpsertUpdate(t *testing.T) { } func TestInstanceSettingBasicSetting(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -116,6 +120,7 @@ func TestInstanceSettingBasicSetting(t *testing.T) { } func TestInstanceSettingGeneralSetting(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -146,6 +151,7 @@ func TestInstanceSettingGeneralSetting(t *testing.T) { } func TestInstanceSettingMemoRelatedSetting(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -179,6 +185,7 @@ func TestInstanceSettingMemoRelatedSetting(t *testing.T) { } func TestInstanceSettingStorageSetting(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -214,6 +221,7 @@ func TestInstanceSettingStorageSetting(t *testing.T) { } func TestInstanceSettingListAll(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) diff --git a/store/test/memo_filter_test.go b/store/test/memo_filter_test.go index 9f2520211..3f5f78f13 100644 --- a/store/test/memo_filter_test.go +++ b/store/test/memo_filter_test.go @@ -16,6 +16,7 @@ import ( // ============================================================================= func TestMemoFilterContentContains(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -39,6 +40,7 @@ func TestMemoFilterContentContains(t *testing.T) { } func TestMemoFilterContentSpecialCharacters(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -49,6 +51,7 @@ func TestMemoFilterContentSpecialCharacters(t *testing.T) { } func TestMemoFilterContentUnicode(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -64,6 +67,7 @@ func TestMemoFilterContentUnicode(t *testing.T) { // ============================================================================= func TestMemoFilterVisibilityEquals(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -83,6 +87,7 @@ func TestMemoFilterVisibilityEquals(t *testing.T) { } func TestMemoFilterVisibilityNotEquals(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -95,6 +100,7 @@ func TestMemoFilterVisibilityNotEquals(t *testing.T) { } func TestMemoFilterVisibilityInList(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -112,6 +118,7 @@ func TestMemoFilterVisibilityInList(t *testing.T) { // ============================================================================= func TestMemoFilterPinnedEquals(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -131,6 +138,7 @@ func TestMemoFilterPinnedEquals(t *testing.T) { } func TestMemoFilterPinnedPredicate(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -149,6 +157,7 @@ func TestMemoFilterPinnedPredicate(t *testing.T) { // ============================================================================= func TestMemoFilterCreatorIdEquals(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -169,6 +178,7 @@ func TestMemoFilterCreatorIdEquals(t *testing.T) { } func TestMemoFilterCreatorIdNotEquals(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -195,6 +205,7 @@ func TestMemoFilterCreatorIdNotEquals(t *testing.T) { // ============================================================================= func TestMemoFilterTagInList(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -213,6 +224,7 @@ func TestMemoFilterTagInList(t *testing.T) { } func TestMemoFilterElementInTags(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -229,6 +241,7 @@ func TestMemoFilterElementInTags(t *testing.T) { } func TestMemoFilterHierarchicalTags(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -241,6 +254,7 @@ func TestMemoFilterHierarchicalTags(t *testing.T) { } func TestMemoFilterEmptyTags(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -257,6 +271,7 @@ func TestMemoFilterEmptyTags(t *testing.T) { // ============================================================================= func TestMemoFilterHasTaskList(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -279,6 +294,7 @@ func TestMemoFilterHasTaskList(t *testing.T) { } func TestMemoFilterHasLink(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -293,6 +309,7 @@ func TestMemoFilterHasLink(t *testing.T) { } func TestMemoFilterHasCode(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -307,6 +324,7 @@ func TestMemoFilterHasCode(t *testing.T) { } func TestMemoFilterHasIncompleteTasks(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -329,6 +347,7 @@ func TestMemoFilterHasIncompleteTasks(t *testing.T) { } func TestMemoFilterCombinedJSONBool(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -367,6 +386,7 @@ func TestMemoFilterCombinedJSONBool(t *testing.T) { // ============================================================================= func TestMemoFilterCreatedTsComparison(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -387,6 +407,7 @@ func TestMemoFilterCreatedTsComparison(t *testing.T) { } func TestMemoFilterCreatedTsWithNow(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -402,6 +423,7 @@ func TestMemoFilterCreatedTsWithNow(t *testing.T) { } func TestMemoFilterCreatedTsArithmetic(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -421,6 +443,7 @@ func TestMemoFilterCreatedTsArithmetic(t *testing.T) { } func TestMemoFilterUpdatedTs(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -444,6 +467,7 @@ func TestMemoFilterUpdatedTs(t *testing.T) { } func TestMemoFilterAllComparisonOperators(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -472,6 +496,7 @@ func TestMemoFilterAllComparisonOperators(t *testing.T) { // ============================================================================= func TestMemoFilterLogicalAnd(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -485,6 +510,7 @@ func TestMemoFilterLogicalAnd(t *testing.T) { } func TestMemoFilterLogicalOr(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -497,6 +523,7 @@ func TestMemoFilterLogicalOr(t *testing.T) { } func TestMemoFilterLogicalNot(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -510,6 +537,7 @@ func TestMemoFilterLogicalNot(t *testing.T) { } func TestMemoFilterNegatedComparison(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -522,6 +550,7 @@ func TestMemoFilterNegatedComparison(t *testing.T) { } func TestMemoFilterComplexLogical(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -552,6 +581,7 @@ func TestMemoFilterComplexLogical(t *testing.T) { // ============================================================================= func TestMemoFilterMultipleFilters(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -570,6 +600,7 @@ func TestMemoFilterMultipleFilters(t *testing.T) { // ============================================================================= func TestMemoFilterNullPayload(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() @@ -581,6 +612,7 @@ func TestMemoFilterNullPayload(t *testing.T) { } func TestMemoFilterNoMatches(t *testing.T) { + t.Parallel() tc := NewMemoFilterTestContext(t) defer tc.Close() diff --git a/store/test/memo_relation_test.go b/store/test/memo_relation_test.go index 32ccaf0b1..9cfba6997 100644 --- a/store/test/memo_relation_test.go +++ b/store/test/memo_relation_test.go @@ -10,6 +10,7 @@ import ( ) func TestMemoRelationStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -62,6 +63,7 @@ func TestMemoRelationStore(t *testing.T) { } func TestMemoRelationListByMemoID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -136,6 +138,7 @@ func TestMemoRelationListByMemoID(t *testing.T) { } func TestMemoRelationDelete(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -193,6 +196,7 @@ func TestMemoRelationDelete(t *testing.T) { } func TestMemoRelationDifferentTypes(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -241,6 +245,7 @@ func TestMemoRelationDifferentTypes(t *testing.T) { } func TestMemoRelationUpsertSameRelation(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -289,6 +294,7 @@ func TestMemoRelationUpsertSameRelation(t *testing.T) { } func TestMemoRelationDeleteByType(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -354,6 +360,7 @@ func TestMemoRelationDeleteByType(t *testing.T) { } func TestMemoRelationDeleteByMemoID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -422,6 +429,7 @@ func TestMemoRelationDeleteByMemoID(t *testing.T) { } func TestMemoRelationListByRelatedMemoID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -479,6 +487,7 @@ func TestMemoRelationListByRelatedMemoID(t *testing.T) { } func TestMemoRelationListCombinedFilters(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -547,6 +556,7 @@ func TestMemoRelationListCombinedFilters(t *testing.T) { } func TestMemoRelationListEmpty(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -571,6 +581,7 @@ func TestMemoRelationListEmpty(t *testing.T) { } func TestMemoRelationBidirectional(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -628,6 +639,7 @@ func TestMemoRelationBidirectional(t *testing.T) { } func TestMemoRelationMultipleRelationsToSameMemo(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) diff --git a/store/test/memo_test.go b/store/test/memo_test.go index bcc368a73..78d9ddce0 100644 --- a/store/test/memo_test.go +++ b/store/test/memo_test.go @@ -13,6 +13,7 @@ import ( ) func TestMemoStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -64,6 +65,7 @@ func TestMemoStore(t *testing.T) { } func TestMemoListByTags(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -96,6 +98,7 @@ func TestMemoListByTags(t *testing.T) { } func TestDeleteMemoStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -117,6 +120,7 @@ func TestDeleteMemoStore(t *testing.T) { } func TestMemoGetByID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -147,6 +151,7 @@ func TestMemoGetByID(t *testing.T) { } func TestMemoGetByUID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -177,6 +182,7 @@ func TestMemoGetByUID(t *testing.T) { } func TestMemoListByVisibility(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -239,6 +245,7 @@ func TestMemoListByVisibility(t *testing.T) { } func TestMemoListWithPagination(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -274,6 +281,7 @@ func TestMemoListWithPagination(t *testing.T) { } func TestMemoUpdatePinned(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -317,6 +325,7 @@ func TestMemoUpdatePinned(t *testing.T) { } func TestMemoUpdateVisibility(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -359,6 +368,7 @@ func TestMemoUpdateVisibility(t *testing.T) { } func TestMemoInvalidUID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -378,6 +388,7 @@ func TestMemoInvalidUID(t *testing.T) { } func TestMemoWithPayload(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) diff --git a/store/test/migrator_test.go b/store/test/migrator_test.go index 54abd27bb..513409bfd 100644 --- a/store/test/migrator_test.go +++ b/store/test/migrator_test.go @@ -13,6 +13,7 @@ import ( // TestFreshInstall verifies that LATEST.sql applies correctly on a fresh database. // This is essentially what NewTestingStore already does, but we make it explicit. func TestFreshInstall(t *testing.T) { + t.Parallel() ctx := context.Background() // NewTestingStore creates a fresh database and runs Migrate() @@ -72,6 +73,7 @@ func testMigration(t *testing.T, driver string, prepareFunc func() (MemosContain // TestMigrationFromPreviousVersion_SQLite verifies that migrating from the previous // Memos version to the current version works correctly for SQLite. func TestMigrationFromPreviousVersion_SQLite(t *testing.T) { + t.Parallel() testMigration(t, "sqlite", func() (MemosContainerConfig, func()) { // Create a temp directory for SQLite data that persists across container restarts dataDir := t.TempDir() @@ -85,6 +87,7 @@ func TestMigrationFromPreviousVersion_SQLite(t *testing.T) { // TestMigrationFromPreviousVersion_MySQL verifies that migrating from the previous // Memos version to the current version works correctly for MySQL. func TestMigrationFromPreviousVersion_MySQL(t *testing.T) { + t.Parallel() testMigration(t, "mysql", func() (MemosContainerConfig, func()) { // For migration testing, we need a dedicated MySQL container dsn, containerHost, cleanup := GetDedicatedMySQLDSN(t) @@ -107,6 +110,7 @@ func TestMigrationFromPreviousVersion_MySQL(t *testing.T) { // TestMigrationFromPreviousVersion_Postgres verifies that migrating from the previous // Memos version to the current version works correctly for PostgreSQL. func TestMigrationFromPreviousVersion_Postgres(t *testing.T) { + t.Parallel() testMigration(t, "postgres", func() (MemosContainerConfig, func()) { // For migration testing, we need a dedicated PostgreSQL container dsn, containerHost, cleanup := GetDedicatedPostgresDSN(t) diff --git a/store/test/reaction_test.go b/store/test/reaction_test.go index 986eed9b2..6f8b220ac 100644 --- a/store/test/reaction_test.go +++ b/store/test/reaction_test.go @@ -10,6 +10,7 @@ import ( ) func TestReactionStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -67,6 +68,7 @@ func TestReactionStore(t *testing.T) { } func TestReactionListByCreatorID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -113,6 +115,7 @@ func TestReactionListByCreatorID(t *testing.T) { } func TestReactionMultipleContentIDs(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -148,6 +151,7 @@ func TestReactionMultipleContentIDs(t *testing.T) { } func TestReactionUpsertDifferentTypes(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) diff --git a/store/test/user_setting_test.go b/store/test/user_setting_test.go index 49927d07b..dfaab1d4c 100644 --- a/store/test/user_setting_test.go +++ b/store/test/user_setting_test.go @@ -12,6 +12,7 @@ import ( ) func TestUserSettingStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -29,6 +30,7 @@ func TestUserSettingStore(t *testing.T) { } func TestUserSettingGetByUserID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -63,6 +65,7 @@ func TestUserSettingGetByUserID(t *testing.T) { } func TestUserSettingUpsertUpdate(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -101,6 +104,7 @@ func TestUserSettingUpsertUpdate(t *testing.T) { } func TestUserSettingRefreshTokens(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -161,6 +165,7 @@ func TestUserSettingRefreshTokens(t *testing.T) { } func TestUserSettingPersonalAccessTokens(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -212,6 +217,7 @@ func TestUserSettingPersonalAccessTokens(t *testing.T) { } func TestUserSettingWebhooks(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -278,6 +284,7 @@ func TestUserSettingWebhooks(t *testing.T) { } func TestUserSettingShortcuts(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -311,6 +318,7 @@ func TestUserSettingShortcuts(t *testing.T) { } func TestUserSettingGetUserByPATHash(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -341,6 +349,7 @@ func TestUserSettingGetUserByPATHash(t *testing.T) { } func TestUserSettingGetUserByPATHashNotFound(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) _, err := createTestingHostUser(ctx, ts) @@ -355,6 +364,7 @@ func TestUserSettingGetUserByPATHashNotFound(t *testing.T) { } func TestUserSettingGetUserByPATHashMultipleUsers(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user1, err := createTestingHostUser(ctx, ts) @@ -395,6 +405,7 @@ func TestUserSettingGetUserByPATHashMultipleUsers(t *testing.T) { } func TestUserSettingGetUserByPATHashMultiplePATsSameUser(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -432,6 +443,7 @@ func TestUserSettingGetUserByPATHashMultiplePATsSameUser(t *testing.T) { } func TestUserSettingUpdatePATLastUsed(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -461,6 +473,7 @@ func TestUserSettingUpdatePATLastUsed(t *testing.T) { } func TestUserSettingGetUserByPATHashWithExpiredToken(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -489,6 +502,7 @@ func TestUserSettingGetUserByPATHashWithExpiredToken(t *testing.T) { } func TestUserSettingGetUserByPATHashAfterRemoval(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -521,6 +535,7 @@ func TestUserSettingGetUserByPATHashAfterRemoval(t *testing.T) { } func TestUserSettingGetUserByPATHashSpecialCharacters(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -555,6 +570,7 @@ func TestUserSettingGetUserByPATHashSpecialCharacters(t *testing.T) { } func TestUserSettingGetUserByPATHashLargeTokenCount(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -586,6 +602,7 @@ func TestUserSettingGetUserByPATHashLargeTokenCount(t *testing.T) { } func TestUserSettingMultipleSettingTypes(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) diff --git a/store/test/user_test.go b/store/test/user_test.go index 2ffa202fd..2446be562 100644 --- a/store/test/user_test.go +++ b/store/test/user_test.go @@ -12,6 +12,7 @@ import ( ) func TestUserStore(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) @@ -40,6 +41,7 @@ func TestUserStore(t *testing.T) { } func TestUserGetByID(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -71,6 +73,7 @@ func TestUserGetByID(t *testing.T) { } func TestUserGetByUsername(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -93,6 +96,7 @@ func TestUserGetByUsername(t *testing.T) { } func TestUserListByRole(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -136,6 +140,7 @@ func TestUserListByRole(t *testing.T) { } func TestUserUpdateRowStatus(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -170,6 +175,7 @@ func TestUserUpdateRowStatus(t *testing.T) { } func TestUserUpdateAllFields(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t) @@ -213,6 +219,7 @@ func TestUserUpdateAllFields(t *testing.T) { } func TestUserListWithLimit(t *testing.T) { + t.Parallel() ctx := context.Background() ts := NewTestingStore(ctx, t)