mirror of
https://gitcode.com/JianFeeeee/webui4frpc.git
synced 2026-10-03 07:34:00 +00:00
feat: Phase C 完成 — ModelRouter 风格 UI 重设计 + 模拟 frps 测试 + lastSync 修复 + 集群作坊搭建
- 主题: sakura×frost 玻璃拟态 (theme.css) + SCSS 变量重映射 - 侧栏: 玻璃侧栏 246px + 渐变品牌区 + 面包屑导航 - 状态页: 玻璃 KPI 卡 + 远程节点/本地服务卡片网格 - 集群页: 英雄玻璃卡 + 横向环拓扑链 + 待办命令/活跃拓扑/日志区 - 令牌环: 新增 lastSync 上次同步时间替代周期计数 - 模拟 frps: frps2/frps3 容器 + test-forward.sh 全链路验证脚本 - 修复: BinaryPath 空导致 worker 不启动, 撤销仅撤第一个 link, 任务复活风暴 (published 追踪)
This commit is contained in:
@ -44,29 +44,28 @@ func TestSingleNodeCycle(t *testing.T) {
|
||||
|
||||
// TestTwoNodesPhaseCollect: leader n1 sends to n2; n1 collects both after n2
|
||||
// stamps; then phase flips and second round syncs.
|
||||
func TestTwoNodesCollectAndSync(t *testing.T) {
|
||||
var n2loaded bool
|
||||
func TestTwoNodesSingleRound(t *testing.T) {
|
||||
eng2 := NewEngine("n2", "n2:7500", "u", "p", "0.71.0", nil,
|
||||
&fakeHandler{load: Load{MemPct: 10, NetPct: 10}}, sendNull, "n2:7500", false)
|
||||
// n2's state must include both (leader + itself) so AliveSuccessor works
|
||||
eng2.state.UpsertNode(Node{ID: "n1", Addr: "n1:7500", Alive: true, IsLeader: true, Load: Load{MemPct: 50, NetPct: 50}})
|
||||
|
||||
// n1 sends a collect-phase token with itself in Passed.
|
||||
eng2.state.UpsertNode(Node{ID: "n1", Addr: "n1:7500", Alive: true, IsLeader: true, Load: eng2.state.Nodes[0].Load})
|
||||
tk := &Token{Cycle: 1, Phase: PhaseCollect, Passed: []string{"n1"},
|
||||
State: *func() *State {
|
||||
s := &State{}
|
||||
s.UpsertNode(Node{ID: "n1", Addr: "n1:7500", Alive: true, IsLeader: true})
|
||||
s.UpsertNode(Node{ID: "n2", Addr: "n2:7500", Alive: true})
|
||||
return s
|
||||
}()}
|
||||
_ = n2loaded
|
||||
// n1 sends a token carrying the cluster picture; single-round processing:
|
||||
// the receiving node adopts it and appends its own info in one pass.
|
||||
tk := &Token{Cycle: 1, State: State{
|
||||
Nodes: []Node{
|
||||
{ID: "n1", Addr: "n1:7500", Alive: true, IsLeader: true},
|
||||
{ID: "n2", Addr: "n2:7500", Alive: true},
|
||||
},
|
||||
}}
|
||||
|
||||
out, err := eng2.OnToken(context.Background(), tk)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !contains(out.Passed, "n2") {
|
||||
t.Fatalf("n2 not stamped in round1, passed=%v", out.Passed)
|
||||
if eng2.State().Find("n2") < 0 {
|
||||
t.Fatal("n2 should be present in adopted state after single-round")
|
||||
}
|
||||
if out == nil {
|
||||
t.Fatal("nil token after processing")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user