21 lines
734 B
Go
21 lines
734 B
Go
package service
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestShouldMarkTempUnschedulableForRefreshError(t *testing.T) {
|
|
t.Run("skip global oauth client secret missing", func(t *testing.T) {
|
|
err := errors.New(`token 刷新失败 (重试后): error: code=400 reason="ANTIGRAVITY_OAUTH_CLIENT_SECRET_MISSING" message="missing antigravity oauth client_secret; set ANTIGRAVITY_OAUTH_CLIENT_SECRET" metadata=map[]`)
|
|
require.False(t, shouldMarkTempUnschedulableForRefreshError(err))
|
|
})
|
|
|
|
t.Run("allow account specific refresh error", func(t *testing.T) {
|
|
err := errors.New("token 刷新失败 (重试后): invalid_grant")
|
|
require.True(t, shouldMarkTempUnschedulableForRefreshError(err))
|
|
})
|
|
}
|