fix: add missing PCE parameter to GenerateTokenPair calls in test files
The JWT GenerateTokenPair functions were updated to require a PCE (Password Changed Epoch) parameter for token invalidation. This commit updates test files in concurrent and performance packages to include this parameter. - internal/concurrent/concurrent_test.go: 2 call sites fixed - internal/performance/benchmark_test.go: 3 call sites fixed - internal/performance/performance_test.go: 4 call sites fixed
This commit is contained in:
@@ -103,7 +103,7 @@ func runTokenValidationConcurrencyTest(t *testing.T, testName string, config Con
|
||||
jwtManager := auth.NewJWT("concurrent-test-secret", 2*time.Hour, 7*24*time.Hour)
|
||||
tokens := make([]string, 100)
|
||||
for i := 0; i < 100; i++ {
|
||||
accessToken, _, err := jwtManager.GenerateTokenPair(int64(i+1), fmt.Sprintf("user%d", i))
|
||||
accessToken, _, err := jwtManager.GenerateTokenPair(int64(i+1), fmt.Sprintf("user%d", i), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("生成Token失败: %v", err)
|
||||
}
|
||||
@@ -192,7 +192,7 @@ func runConcurrencyTest(t *testing.T, testName string, config ConcurrencyTestCon
|
||||
}
|
||||
reqStart := time.Now()
|
||||
// 模拟 Token 生成操作(代替真实登录)
|
||||
_, _, err := jwtManager.GenerateTokenPair(int64(id+1), fmt.Sprintf("user%d", id))
|
||||
_, _, err := jwtManager.GenerateTokenPair(int64(id+1), fmt.Sprintf("user%d", id), 0)
|
||||
latency := time.Since(reqStart)
|
||||
mu.Lock()
|
||||
latencies = append(latencies, latency)
|
||||
|
||||
Reference in New Issue
Block a user