feat(deploy): 在线更新 - 新增后台检查、强制备份迁移与失败自动回退

This commit is contained in:
ddCat
2026-08-30 22:15:17 +08:00
parent 8227921c68
commit 694cb974fb
60 changed files with 4124 additions and 93 deletions

View File

@@ -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())