Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(tests): update goroutine handling in new question email worker tests

LinkinStars9df5853942f1
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
-}