You've already forked agentic-coding-workflow
feat(app): wire workspace module + integration test for ws closed loop
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -50,6 +51,20 @@ func TestLoad_MasterKeyNotHex(t *testing.T) {
|
||||
require.Contains(t, err.Error(), "invalid hex")
|
||||
}
|
||||
|
||||
func TestLoad_WorkspaceDefaults(t *testing.T) {
|
||||
// 验证 workspace.* 与 git.* 的默认值(含 string→time.Duration 自动解析)。
|
||||
t.Setenv("APP_DB_DSN", "postgres://x")
|
||||
t.Setenv("APP_MASTER_KEY", "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff")
|
||||
cfg, err := Load("")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "./data", cfg.Workspace.DataDir)
|
||||
require.Equal(t, 30*time.Minute, cfg.Workspace.CloneTimeout)
|
||||
require.Equal(t, 5*time.Minute, cfg.Workspace.FetchTimeout)
|
||||
require.Equal(t, 5*time.Minute, cfg.Workspace.PushTimeout)
|
||||
require.Equal(t, 60*time.Second, cfg.Workspace.OpsTimeout)
|
||||
require.Equal(t, "git", cfg.Git.Binary)
|
||||
}
|
||||
|
||||
func TestMasterKey_Redaction(t *testing.T) {
|
||||
k := MasterKey([]byte{0x01, 0x02, 0x03})
|
||||
require.Equal(t, "[REDACTED 32B]", k.String())
|
||||
|
||||
Reference in New Issue
Block a user