mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-06-11 23:03:08 +08:00
Remove node runtime and config surface
This commit is contained in:
@@ -93,29 +93,6 @@ func TestValidateSubagentsRequiresPromptFileWhenEnabled(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateNodeBackedSubagentAllowsMissingPromptFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Agents.Router.Enabled = true
|
||||
cfg.Agents.Router.MainAgentID = "main"
|
||||
cfg.Agents.Subagents["main"] = SubagentConfig{
|
||||
Enabled: true,
|
||||
Type: "router",
|
||||
SystemPromptFile: "agents/main/AGENT.md",
|
||||
}
|
||||
cfg.Agents.Subagents["node.edge.main"] = SubagentConfig{
|
||||
Enabled: true,
|
||||
Type: "worker",
|
||||
Transport: "node",
|
||||
NodeID: "edge",
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) != 0 {
|
||||
t.Fatalf("expected node-backed config to be valid, got %v", errs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateSubagentsRejectsInvalidNotifyMainPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -134,81 +111,6 @@ func TestValidateSubagentsRejectsInvalidNotifyMainPolicy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultConfigDisablesGatewayNodeP2P(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
if cfg.Gateway.Nodes.P2P.Enabled {
|
||||
t.Fatalf("expected gateway node p2p to be disabled by default")
|
||||
}
|
||||
if cfg.Gateway.Nodes.P2P.Transport != "websocket_tunnel" {
|
||||
t.Fatalf("unexpected default gateway node p2p transport: %s", cfg.Gateway.Nodes.P2P.Transport)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRejectsUnknownGatewayNodeP2PTransport(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.P2P.Transport = "udp"
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateGatewayNodeP2PIceServersAllowsStunOnly(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.P2P.ICEServers = []GatewayICEConfig{
|
||||
{URLs: []string{"stun:stun.l.google.com:19302"}},
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) != 0 {
|
||||
t.Fatalf("expected config to be valid, got %v", errs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateGatewayNodeP2PIceServersRequireTurnCredentials(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.P2P.ICEServers = []GatewayICEConfig{
|
||||
{URLs: []string{"turn:turn.example.com:3478?transport=udp"}},
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateGatewayNodeDispatchRejectsEmptyTagKey(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.Dispatch.ActionTags = map[string][]string{
|
||||
"": {"vision"},
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateGatewayNodeDispatchRejectsEmptyAllowNodeKey(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.Dispatch.AllowActions = map[string][]string{
|
||||
"": {"screen_snapshot"},
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateSentinelWebhookURLRejectsInvalidScheme(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -233,47 +135,6 @@ func TestValidateSentinelWebhookURLAllowsHTTPS(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultConfigSetsNodeArtifactRetentionDefaults(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
if cfg.Gateway.Nodes.Artifacts.Enabled {
|
||||
t.Fatalf("expected node artifact retention disabled by default")
|
||||
}
|
||||
if cfg.Gateway.Nodes.Artifacts.KeepLatest != 500 {
|
||||
t.Fatalf("unexpected default keep_latest: %d", cfg.Gateway.Nodes.Artifacts.KeepLatest)
|
||||
}
|
||||
if cfg.Gateway.Nodes.Artifacts.RetainDays != 7 {
|
||||
t.Fatalf("unexpected default retain_days: %d", cfg.Gateway.Nodes.Artifacts.RetainDays)
|
||||
}
|
||||
if !cfg.Gateway.Nodes.Artifacts.PruneOnRead {
|
||||
t.Fatalf("expected prune_on_read enabled by default")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateNodeArtifactRetentionRequiresPositiveKeepLatestWhenEnabled(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.Artifacts.Enabled = true
|
||||
cfg.Gateway.Nodes.Artifacts.KeepLatest = 0
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateNodeArtifactRetentionRejectsNegativeRetainDays(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.Artifacts.RetainDays = -1
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateProviderOAuthAllowsEmptyModelsBeforeLogin(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user