fix: ship the rebuilt binary with heartbeat_ack fix + test (v1.3.1)
The prebuilt theta-agent-linux-amd64 was built before the v1.3.0 heartbeat_ack fix, so the installed agent still logged 'Unknown command type: heartbeat_ack'. Rebuild it with the fix; add a test asserting heartbeat_ack is silently ignored (no response, no command, no log).
This commit is contained in:
@@ -51,6 +51,9 @@ func TestHandleCommand(t *testing.T) {
|
||||
expectedCmd []string
|
||||
expectedFile string
|
||||
expectedFileCont string
|
||||
// heartbeat_ack (and any fire-and-forget ack) must be silently ignored —
|
||||
// no response message, no command, no log noise.
|
||||
expectedNoResponse bool
|
||||
}{
|
||||
{
|
||||
name: "config command success",
|
||||
@@ -175,6 +178,16 @@ func TestHandleCommand(t *testing.T) {
|
||||
expectedStatus: "error",
|
||||
expectedCmd: nil,
|
||||
},
|
||||
{
|
||||
name: "heartbeat_ack is silently ignored",
|
||||
cfg: &Config{
|
||||
Capabilities: Capabilities{},
|
||||
},
|
||||
msg: WSMessage{
|
||||
Type: "heartbeat_ack",
|
||||
},
|
||||
expectedNoResponse: true,
|
||||
},
|
||||
{
|
||||
name: "unknown command",
|
||||
cfg: &Config{
|
||||
@@ -194,6 +207,16 @@ func TestHandleCommand(t *testing.T) {
|
||||
cm := &ConfigManager{current: tc.cfg}
|
||||
handleCommand(cm, tc.msg, mockConn, mockExec)
|
||||
|
||||
if tc.expectedNoResponse {
|
||||
if len(mockConn.Messages) != 0 {
|
||||
t.Fatalf("expected no response message, got %d: %v", len(mockConn.Messages), mockConn.Messages)
|
||||
}
|
||||
if len(mockExec.ExecutedCommands) > 0 {
|
||||
t.Errorf("expected no commands to be executed, but got %v", mockExec.ExecutedCommands)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if len(mockConn.Messages) != 1 {
|
||||
t.Fatalf("expected 1 response message, got %d", len(mockConn.Messages))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user