lolly/internal/e2e/testutil/constants.go
xfy 0790c5a9e4 test(e2e/testutil): 扩展测试工具包
添加配置生成、常量定义、测试设置、SSL 和 WebSocket 工具函数。
重构 container.go 支持函数式选项模式配置容器。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 14:51:11 +08:00

71 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//go:build e2e
// Package testutil 提供 E2E 测试的工具函数。
//
// 包含测试常量定义。
//
// 作者xfy
package testutil
import (
"crypto/tls"
"time"
)
// 测试超时常量。
const (
// ContainerStartupTimeout 容器启动超时。
ContainerStartupTimeout = 30 * time.Second
// HealthCheckWaitTimeout 健康检查等待超时。
HealthCheckWaitTimeout = 30 * time.Second
// HealthCheckDetectionTime 健康检查检测时间。
HealthCheckDetectionTime = 10 * time.Second
// CacheExpireBuffer 缓存过期缓冲时间。
CacheExpireBuffer = 1 * time.Second
// DefaultTestTimeout 测试上下文超时。
DefaultTestTimeout = 180 * time.Second
// DefaultClientTimeout HTTP 客户端超时。
DefaultClientTimeout = 10 * time.Second
// ConcurrentRequestTimeout 并发请求超时。
ConcurrentRequestTimeout = 30 * time.Second
// ShortTestTimeout 短测试超时(用于快速测试)。
ShortTestTimeout = 60 * time.Second
// MediumTestTimeout 中等测试超时。
MediumTestTimeout = 120 * time.Second
)
// 测试配置常量。
const (
// DefaultBackendCount 默认后端数量。
DefaultBackendCount = 2
// DefaultConcurrentRequests 并发请求数量。
DefaultConcurrentRequests = 10
// HighConcurrentRequests 高并发请求数量。
HighConcurrentRequests = 20
// CacheTestMaxAge 缓存测试过期时间。
CacheTestMaxAge = 5 * time.Minute
// CacheTestShortMaxAge 短缓存过期时间(用于过期测试)。
CacheTestShortMaxAge = 2 * time.Second
)
// TLS 版本常量(用于配置客户端)。
const (
// TLSVersion12 TLS 1.2。
TLSVersion12 = tls.VersionTLS12
// TLSVersion13 TLS 1.3。
TLSVersion13 = tls.VersionTLS13
)