You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2026/07/07 11:32:34 UTC

(answer) branch dev updated: fix(tests): update goroutine handling in new question email worker tests

This is an automated email from the ASF dual-hosted git repository.

LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git


The following commit(s) were added to refs/heads/dev by this push:
     new 9df58539 fix(tests): update goroutine handling in new question email worker tests
9df58539 is described below

commit 9df5853942f17fccc81d0c3a449cbb7fc51d4ff4
Author: LinkinStars <li...@foxmail.com>
AuthorDate: Tue Jul 7 19:32:24 2026 +0800

    fix(tests): update goroutine handling in new question email worker tests
---
 .../notification/new_question_email_worker_test.go        |  7 +++++--
 .../notification/new_question_notification_test.go        | 15 ---------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/internal/service/notification/new_question_email_worker_test.go b/internal/service/notification/new_question_email_worker_test.go
index 739dfe50..c708ffd2 100644
--- a/internal/service/notification/new_question_email_worker_test.go
+++ b/internal/service/notification/new_question_email_worker_test.go
@@ -407,7 +407,10 @@ func TestNewQuestionEmailWorkerTryEnqueueConcurrentClose(t *testing.T) {
 		var wg sync.WaitGroup
 
 		for range senders {
-			wg.Go(func() {
+			//nolint:modernize // CI uses Go 1.23, which does not support WaitGroup.Go.
+			wg.Add(1)
+			go func() {
+				defer wg.Done()
 				defer func() {
 					if recovered := recover(); recovered != nil {
 						panicCh <- recovered
@@ -426,7 +429,7 @@ func TestNewQuestionEmailWorkerTryEnqueueConcurrentClose(t *testing.T) {
 					}
 					runtime.Gosched()
 				}
-			})
+			}()
 		}
 		for range senders {
 			<-ready
diff --git a/internal/service/notification/new_question_notification_test.go b/internal/service/notification/new_question_notification_test.go
index 3bb6a3dd..754481f6 100644
--- a/internal/service/notification/new_question_notification_test.go
+++ b/internal/service/notification/new_question_notification_test.go
@@ -798,18 +798,3 @@ func (newQuestionNotificationTestUserExternalLoginRepo) GetCacheUserExternalLogi
 	context.Context, string) (*schema.ExternalLoginUserInfoCache, error) {
 	return nil, nil
 }
-
-func (newQuestionNotificationTestUserExternalLoginRepo) SetCacheOAuthState(
-	context.Context, string, *schema.ExternalLoginOAuthState, time.Duration) error {
-	return nil
-}
-
-func (newQuestionNotificationTestUserExternalLoginRepo) GetCacheOAuthState(
-	context.Context, string) (*schema.ExternalLoginOAuthState, error) {
-	return nil, nil
-}
-
-func (newQuestionNotificationTestUserExternalLoginRepo) DeleteCacheOAuthState(
-	context.Context, string) error {
-	return nil
-}