feat: master/agent phase 2 — jobs and manual update (#7) #20

Merged
shcizo merged 29 commits from feat/master-agent-jobs-7 into main 2026-10-12 17:58:54 +00:00
Showing only changes of commit 961ddd275c - Show all commits
+7 -3
View File
@@ -2,6 +2,7 @@ package hub
import ( import (
"context" "context"
"errors"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@@ -106,9 +107,12 @@ func TestHub_StartJobOnReplacedConnectionFails(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer second.CloseNow() defer second.CloseNow()
// Until the new connection says hello, nothing is routable and the old // dial returns before the hub has registered the connection, so wait for
// route is refused. // the replacement to take effect: the old route is then refused. Until the
assert.ErrorIs(t, h.StartJob(old, 1, protocol.JobStart{}), model.ErrAgentOffline) // new connection says hello, nothing is routable.
require.Eventually(t, func() bool {
return errors.Is(h.StartJob(old, 1, protocol.JobStart{}), model.ErrAgentOffline)
}, 2*time.Second, 5*time.Millisecond)
send(t, second, protocol.TypeHello, protocol.Hello{ProtocolVersion: 2}) send(t, second, protocol.TypeHello, protocol.Hello{ProtocolVersion: 2})
fresh := waitRoute(t, h) fresh := waitRoute(t, h)
require.NotEqual(t, old.ConnID, fresh.ConnID) require.NotEqual(t, old.ConnID, fresh.ConnID)