feat(deploy): 在线更新 - 新增后台检查、强制备份迁移与失败自动回退
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -19,6 +20,19 @@ func TestAllowedOriginWildcard(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnvironmentParsers(t *testing.T) {
|
||||
t.Setenv("CANVAS_AUTO_MIGRATE", "false")
|
||||
value, err := envBool("CANVAS_AUTO_MIGRATE", true)
|
||||
if err != nil || value {
|
||||
t.Fatalf("envBool = %v, %v", value, err)
|
||||
}
|
||||
t.Setenv("CANVAS_SHUTDOWN_TIMEOUT", "45s")
|
||||
duration, err := envDuration("CANVAS_SHUTDOWN_TIMEOUT", time.Minute)
|
||||
if err != nil || duration != 45*time.Second {
|
||||
t.Fatalf("envDuration = %v, %v", duration, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllowedOriginUsesForwardedHost(t *testing.T) {
|
||||
t.Setenv("CANVAS_CORS_ORIGINS", "")
|
||||
context, _ := gin.CreateTestContext(httptest.NewRecorder())
|
||||
|
||||
Reference in New Issue
Block a user