mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 16:04:50 +03:00
0afa11ddff
Replace full inbound/client-list downloads on cold remote ID lookups with an owner-scoped six-field catalog projected directly from the database. Coalesce concurrent catalog refreshes per remote while preserving independent caller cancellation and rejecting stale ID mappings after topology mutations. Seed reconciliation from the catalog, create missing inbounds directly, preserve prefixed/adopted aliases and invalidate pushed state when remote IDs change. Avoid invalidating catalog generations on unchanged-ID settings pushes. Retain client-membership-aware reconciliation state and legacy full-list fallback only on HTTP 404/405. Cover permissions, query projection, concurrent refresh/cancellation, deletion/recreation, reconciliation request counts and mixed-version node compatibility. Integrated CI and Docs CI passed, including race, node E2E and PostgreSQL catalog projection. Synthetic response-size comparison is not a production latency benchmark. Fixes #7303.
490 lines
17 KiB
Go
490 lines
17 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"errors"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"slices"
|
|
"strconv"
|
|
"strings"
|
|
"sync"
|
|
"testing"
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
|
|
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
|
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
|
"github.com/mhsanaei/3x-ui/v3/internal/web/runtime"
|
|
)
|
|
|
|
type groupedCreatePeer struct {
|
|
mu sync.Mutex
|
|
tags map[string]int
|
|
settings map[int]string
|
|
adds []ClientCreatePayload
|
|
updates []int
|
|
respond func(http.ResponseWriter, *http.Request, ClientCreatePayload, func(int))
|
|
mutate func(http.ResponseWriter, *http.Request)
|
|
}
|
|
|
|
func (p *groupedCreatePeer) serve(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
switch {
|
|
case strings.HasSuffix(r.URL.Path, "/inbounds/catalog"), strings.HasSuffix(r.URL.Path, "/inbounds/list"):
|
|
p.mu.Lock()
|
|
catalog := make([]runtime.RemoteInboundOption, 0, len(p.tags))
|
|
for tag, id := range p.tags {
|
|
catalog = append(catalog, runtime.RemoteInboundOption{Id: id, Tag: tag})
|
|
}
|
|
p.mu.Unlock()
|
|
_ = json.NewEncoder(w).Encode(map[string]any{"success": true, "obj": catalog})
|
|
case strings.HasSuffix(r.URL.Path, "/clients/add"):
|
|
var payload ClientCreatePayload
|
|
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
p.mu.Lock()
|
|
p.adds = append(p.adds, payload)
|
|
p.mu.Unlock()
|
|
apply := func(count int) {
|
|
p.mu.Lock()
|
|
defer p.mu.Unlock()
|
|
for _, id := range payload.InboundIds[:count] {
|
|
var settings map[string]any
|
|
_ = json.Unmarshal([]byte(p.settings[id]), &settings)
|
|
clients, _ := settings["clients"].([]any)
|
|
if slices.ContainsFunc(clients, func(entry any) bool {
|
|
_, email := clientEntryEmail(entry)
|
|
return email == payload.Client.Email
|
|
}) {
|
|
continue
|
|
}
|
|
settings["clients"] = append(clients, payload.Client)
|
|
encoded, _ := json.Marshal(settings)
|
|
p.settings[id] = string(encoded)
|
|
}
|
|
}
|
|
if p.respond != nil {
|
|
p.respond(w, r, payload, apply)
|
|
return
|
|
}
|
|
apply(len(payload.InboundIds))
|
|
_, _ = w.Write([]byte(`{"success":true}`))
|
|
case strings.Contains(r.URL.Path, "/inbounds/update/"):
|
|
_, suffix, _ := strings.Cut(r.URL.Path, "/inbounds/update/")
|
|
id, err := strconv.Atoi(suffix)
|
|
if err != nil || r.ParseForm() != nil || r.Form.Get("settings") == "" {
|
|
http.Error(w, "missing inbound ID or settings", http.StatusBadRequest)
|
|
return
|
|
}
|
|
p.mu.Lock()
|
|
p.settings[id] = r.Form.Get("settings")
|
|
p.updates = append(p.updates, id)
|
|
p.mu.Unlock()
|
|
_, _ = w.Write([]byte(`{"success":true}`))
|
|
default:
|
|
if p.mutate == nil {
|
|
http.NotFound(w, r)
|
|
} else {
|
|
p.mutate(w, r)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestGroupedCreateRecoversIndeterminateDelivery(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
name string
|
|
reason string
|
|
reply func(w http.ResponseWriter, r *http.Request, apply func(int))
|
|
}{
|
|
{"partially applied HTTP error", "push_failed", func(w http.ResponseWriter, _ *http.Request, apply func(int)) {
|
|
apply(1)
|
|
http.Error(w, "second write failed", http.StatusInternalServerError)
|
|
}},
|
|
{"lost acknowledgment", "push_failed", func(w http.ResponseWriter, _ *http.Request, apply func(int)) {
|
|
apply(2)
|
|
conn, _, err := w.(http.Hijacker).Hijack()
|
|
if err == nil {
|
|
_ = conn.Close()
|
|
}
|
|
}},
|
|
{"deadline after persistence", "timeout", func(_ http.ResponseWriter, r *http.Request, apply func(int)) {
|
|
apply(2)
|
|
<-r.Context().Done()
|
|
}},
|
|
{"malformed acknowledgment", "push_failed", func(w http.ResponseWriter, _ *http.Request, apply func(int)) {
|
|
apply(1)
|
|
_, _ = w.Write([]byte(`{"success":true,"obj":{"nodePending":"unknown"}}`))
|
|
}},
|
|
{"downstream pending", "downstream_pending", func(w http.ResponseWriter, _ *http.Request, apply func(int)) {
|
|
apply(2)
|
|
_, _ = w.Write([]byte(`{"success":true,"obj":{"nodePending":true}}`))
|
|
}},
|
|
} {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
peer, node, inbounds, remote := setupGroupedCreatePeer(t)
|
|
peer.respond = func(w http.ResponseWriter, r *http.Request, _ ClientCreatePayload, apply func(int)) {
|
|
tc.reply(w, r, apply)
|
|
}
|
|
client := groupedRecoveryClient("unknown-delivery@x")
|
|
svc := (&ClientService{}).TrackNodeApplies()
|
|
inboundSvc := &InboundService{}
|
|
payload := &ClientCreatePayload{Client: client, InboundIds: []int{inbounds[0].Id, inbounds[1].Id}}
|
|
if _, err := svc.Create(inboundSvc, payload); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
wantGroupedOutcome(t, &svc, node.Id, "pending", tc.reason)
|
|
dirtyAt := groupedDirtyGeneration(t, node.Id)
|
|
if _, err := (&ClientService{}).Create(inboundSvc, payload); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got := groupedDirtyGeneration(t, node.Id); dirtyAt != got {
|
|
t.Fatalf("idempotent create changed generation from %d to %d", dirtyAt, got)
|
|
}
|
|
for _, inbound := range inbounds {
|
|
if got := settingsClientEmails(t, inbound.Id); !slices.Equal(got, []string{client.Email}) {
|
|
t.Fatalf("master inbound %d lost or duplicated commits: %v", inbound.Id, got)
|
|
}
|
|
}
|
|
want := []int{101, 102}
|
|
if tc.reason == "downstream_pending" {
|
|
want = nil
|
|
}
|
|
assertGroupedRecovery(t, peer, node, remote, inbounds, 1, want)
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestGroupedCreateDispatchesIndependentReadyPayload(t *testing.T) {
|
|
peer, _, inbounds, _ := setupGroupedCreatePeer(t)
|
|
first, second := inbounds[0], inbounds[1]
|
|
if err := database.GetDB().Model(first).Update("stream_settings", `{"network":"tcp","security":"reality"}`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
slow, healthy, release := make(chan struct{}), make(chan struct{}), make(chan struct{})
|
|
free := sync.OnceFunc(func() { close(release) })
|
|
t.Cleanup(free)
|
|
peer.respond = func(w http.ResponseWriter, r *http.Request, payload ClientCreatePayload, apply func(int)) {
|
|
if slices.Equal(payload.InboundIds, []int{101}) && payload.Client.Flow == "xtls-rprx-vision" {
|
|
close(slow)
|
|
select {
|
|
case <-release:
|
|
case <-r.Context().Done():
|
|
return
|
|
}
|
|
} else if slices.Equal(payload.InboundIds, []int{102}) && payload.Client.Flow == "" {
|
|
close(healthy)
|
|
} else {
|
|
http.Error(w, "unexpected grouping", http.StatusBadRequest)
|
|
return
|
|
}
|
|
apply(1)
|
|
_, _ = w.Write([]byte(`{"success":true}`))
|
|
}
|
|
ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second)
|
|
done := make(chan struct{})
|
|
var createErr error
|
|
t.Cleanup(func() { cancel(); free(); <-done })
|
|
go func() {
|
|
defer close(done)
|
|
client := groupedRecoveryClient("independent-flow@x")
|
|
client.Flow = "xtls-rprx-vision"
|
|
_, createErr = (&ClientService{}).CreateWithContext(ctx, &InboundService{}, &ClientCreatePayload{
|
|
Client: client, InboundIds: []int{first.Id, second.Id},
|
|
})
|
|
}()
|
|
for _, call := range []<-chan struct{}{slow, healthy} {
|
|
select {
|
|
case <-call:
|
|
case <-ctx.Done():
|
|
t.Fatal("independent payload waited behind the parked RPC")
|
|
}
|
|
}
|
|
free()
|
|
<-done
|
|
if createErr != nil {
|
|
t.Fatal(createErr)
|
|
}
|
|
}
|
|
|
|
func TestGroupedCreateRepairsDeferredTargets(t *testing.T) {
|
|
for _, scenario := range []string{"missing tag", "disabled client", "pruned orphan", "one rollback", "transport panic"} {
|
|
t.Run(scenario, func(t *testing.T) {
|
|
peer, node, inbounds, remote := setupGroupedCreatePeer(t)
|
|
first, second := inbounds[0], inbounds[1]
|
|
db := database.GetDB()
|
|
wantAdds, status, reason, want := 1, "pending", "deferred", []int{101}
|
|
client := groupedRecoveryClient("recover-target@x")
|
|
switch scenario {
|
|
case "missing tag":
|
|
delete(peer.tags, first.Tag)
|
|
reason = "push_failed"
|
|
case "disabled client":
|
|
client.Enable = false
|
|
wantAdds, want = 0, []int{101, 102}
|
|
case "pruned orphan":
|
|
first.Settings = clientsSettings(t, []model.Client{groupedRecoveryClient("removed@x")})
|
|
if err := db.Model(first).Update("settings", first.Settings).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
remote.RecordAdoptedInbound(first)
|
|
peer.settings[101] = first.Settings
|
|
case "one rollback":
|
|
status, reason, want = "failed", "local_save_failed", nil
|
|
const callback = "test:grouped-create-local-rollback"
|
|
if err := db.Callback().Update().After("gorm:update").Register(callback, func(tx *gorm.DB) {
|
|
vars := tx.Statement.Vars
|
|
if tx.Statement.Table == "inbounds" && len(vars) == 2 && vars[1] == first.Id {
|
|
_ = tx.AddError(errors.New("forced create rollback"))
|
|
}
|
|
}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Cleanup(func() { _ = db.Callback().Update().Remove(callback) })
|
|
case "transport panic":
|
|
wantAdds, reason, want = 0, "push_failed", []int{101, 102}
|
|
failing := *node
|
|
failing.OutboundTag = "test-egress"
|
|
remote = runtime.NewRemote(&failing, panickingCreateEgress{})
|
|
runtime.GetManager().SetRuntimeOverride(node.Id, remote)
|
|
for _, inbound := range inbounds {
|
|
remote.RecordAdoptedInbound(inbound)
|
|
}
|
|
}
|
|
svc := (&ClientService{}).TrackNodeApplies()
|
|
_, err := svc.Create(&InboundService{}, &ClientCreatePayload{Client: client, InboundIds: []int{first.Id, second.Id}})
|
|
if scenario == "one rollback" {
|
|
if err == nil || !strings.Contains(err.Error(), "forced create rollback") {
|
|
t.Fatalf("partial local failure = %v", err)
|
|
}
|
|
if _, ok := settingsClient(t, first.Id, client.Email); ok {
|
|
t.Fatal("rolled back inbound retained its client")
|
|
}
|
|
} else if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, ok := settingsClient(t, second.Id, client.Email); !ok {
|
|
t.Fatal("successful inbound lost its committed client")
|
|
}
|
|
wantGroupedOutcome(t, &svc, node.Id, status, reason)
|
|
groupedDirtyGeneration(t, node.Id)
|
|
if scenario == "transport panic" {
|
|
nodeConfigDispatchMu.Lock()
|
|
leftover := nodeConfigDispatch[node.Id]
|
|
nodeConfigDispatchMu.Unlock()
|
|
if leftover != nil {
|
|
t.Fatal("recovered transport panic left a reserved node turn")
|
|
}
|
|
remote = runtime.NewRemote(node, nil)
|
|
}
|
|
peer.mu.Lock()
|
|
peer.tags[first.Tag] = 101
|
|
peer.mu.Unlock()
|
|
assertGroupedRecovery(t, peer, node, remote, inbounds, wantAdds, want)
|
|
})
|
|
}
|
|
}
|
|
|
|
type panickingCreateEgress struct{}
|
|
|
|
func (panickingCreateEgress) NodeEgressProxyURL(int) string { panic("fixture egress failure") }
|
|
|
|
func TestGroupedCreatePreservesProtocolCredentials(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
protocol model.Protocol
|
|
settings string
|
|
check func(model.Client) bool
|
|
}{
|
|
{model.Shadowsocks, `{"clients":[],"method":"2022-blake3-aes-128-gcm"}`, func(c model.Client) bool {
|
|
return validShadowsocksClientKey("2022-blake3-aes-128-gcm", c.Password)
|
|
}},
|
|
{model.MTProto, `{"clients":[],"fakeTlsDomain":"example.test"}`, func(c model.Client) bool { return c.Secret != "" }},
|
|
{model.TUIC, `{"clients":[]}`, func(c model.Client) bool { return c.ID != "" && c.Password != "" }},
|
|
} {
|
|
t.Run(string(tc.protocol), func(t *testing.T) {
|
|
peer, _, inbounds, remote := setupGroupedCreatePeer(t)
|
|
db := database.GetDB()
|
|
var ids []int
|
|
for _, ib := range inbounds {
|
|
if err := db.Model(ib).Updates(map[string]any{"protocol": tc.protocol, "settings": tc.settings}).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
ids = append(ids, ib.Id)
|
|
}
|
|
first, second := inbounds[0], inbounds[1]
|
|
delete(peer.tags, first.Tag)
|
|
peer.tags["adopted-legacy-tag"] = 101
|
|
remote.AdoptInboundAlias(first, runtime.RemoteInboundOption{Tag: "adopted-legacy-tag", Id: 101})
|
|
delete(peer.tags, second.Tag)
|
|
peer.tags["n"+strconv.Itoa(*second.NodeID)+"-"+second.Tag] = 102
|
|
|
|
const email = "protocol-default-create"
|
|
if _, err := (&ClientService{}).Create(&InboundService{}, &ClientCreatePayload{
|
|
Client: model.Client{Email: email, Enable: true}, InboundIds: ids,
|
|
}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
peer.mu.Lock()
|
|
adds := slices.Clone(peer.adds)
|
|
peer.mu.Unlock()
|
|
if len(adds) != 1 || !slices.Equal(adds[0].InboundIds, []int{101, 102}) || !tc.check(adds[0].Client) {
|
|
t.Fatalf("expected one acknowledged %s add with generated credentials and both mapped IDs", tc.protocol)
|
|
}
|
|
want := adds[0].Client
|
|
for _, ib := range inbounds {
|
|
local, ok := settingsClient(t, ib.Id, email)
|
|
if !ok || local.ID != want.ID || local.Secret != want.Secret || local.Password != want.Password {
|
|
t.Fatalf("grouped RPC changed the local %s credentials for inbound %d", tc.protocol, ib.Id)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func groupedRecoveryClient(email string) model.Client {
|
|
return model.Client{
|
|
Email: email, Enable: true, ID: "bbbbbbbb-1111-2222-3333-555555555555", SubID: email,
|
|
}
|
|
}
|
|
|
|
func wantGroupedOutcome(t *testing.T, svc *ClientService, nodeID int, status, reason string) {
|
|
t.Helper()
|
|
res := svc.NodeApplyResponse()
|
|
want := []ClientNodeApplyOutcome{{NodeID: nodeID, Status: status, Reason: reason}}
|
|
if res == nil || res.NodePending != (status == "pending") || !slices.Equal(res.NodeResults, want) {
|
|
t.Fatalf("node outcome = %+v, want %v", res, want)
|
|
}
|
|
}
|
|
|
|
func groupedDirtyGeneration(t *testing.T, nodeID int) int64 {
|
|
t.Helper()
|
|
_, _, dirty, generation, err := (&NodeService{}).NodeSyncState(nodeID)
|
|
if err != nil || !dirty || generation <= 0 {
|
|
t.Fatalf("node dirty=%t generation=%d err=%v", dirty, generation, err)
|
|
}
|
|
return generation
|
|
}
|
|
|
|
func assertGroupedRecovery(t *testing.T, peer *groupedCreatePeer, node *model.Node, remote *runtime.Remote, inbounds []*model.Inbound, addCount int, wantUpdates []int) {
|
|
t.Helper()
|
|
svc := &InboundService{}
|
|
ctx, cancel := context.WithTimeout(t.Context(), 5*time.Second)
|
|
defer cancel()
|
|
for range 2 {
|
|
if err := svc.ReconcileNode(ctx, remote, node); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
peer.mu.Lock()
|
|
defer peer.mu.Unlock()
|
|
slices.Sort(peer.updates)
|
|
if len(peer.adds) != addCount || !slices.Equal(peer.updates, wantUpdates) {
|
|
t.Fatalf("add RPCs=%d, repaired IDs=%v, want %d and %v", len(peer.adds), peer.updates, addCount, wantUpdates)
|
|
}
|
|
for _, ib := range inbounds {
|
|
master := settingsClientEmails(t, ib.Id)
|
|
var doc struct{ Clients []model.Client }
|
|
if err := json.Unmarshal([]byte(peer.settings[peer.tags[ib.Tag]]), &doc); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got := emailsOf(doc.Clients); !slices.Equal(got, master) {
|
|
t.Fatalf("node inbound %q has %v, master has %v", ib.Tag, got, master)
|
|
}
|
|
}
|
|
}
|
|
|
|
func setupGroupedCreatePeer(t *testing.T) (*groupedCreatePeer, *model.Node, []*model.Inbound, *runtime.Remote) {
|
|
t.Helper()
|
|
setupClientNodeOrderDB(t)
|
|
mgr := useTestRuntimeManager(t)
|
|
peer := &groupedCreatePeer{tags: map[string]int{}, settings: map[int]string{}}
|
|
srv := httptest.NewServer(http.HandlerFunc(peer.serve))
|
|
t.Cleanup(srv.Close)
|
|
nodeHTTP := &fakeNodeHTTP{srv: srv, tags: peer.tags}
|
|
first := realNodeInbound(t, nodeHTTP, 46201, nil)
|
|
second := nodeInbound(t, *first.NodeID, 46202, nil)
|
|
peer.tags[second.Tag] = 102
|
|
var node model.Node
|
|
if err := database.GetDB().First(&node, *first.NodeID).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
rt, err := mgr.RuntimeFor(&node.Id)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
remote, ok := rt.(*runtime.Remote)
|
|
if !ok {
|
|
t.Fatalf("runtime = %T, want actual remote", rt)
|
|
}
|
|
inbounds := []*model.Inbound{first, second}
|
|
for _, inbound := range inbounds {
|
|
remote.RecordAdoptedInbound(inbound)
|
|
peer.settings[peer.tags[inbound.Tag]] = inbound.Settings
|
|
}
|
|
return peer, &node, inbounds, remote
|
|
}
|
|
|
|
func TestGroupedCreateReconcilesUnsentRebasedSettings(t *testing.T) {
|
|
peer, node, inbounds, remote := setupGroupedCreatePeer(t)
|
|
svc := (&ClientService{}).TrackNodeApplies()
|
|
inboundSvc := &InboundService{}
|
|
changed := inbounds[0]
|
|
client := model.Client{
|
|
Email: "group-rebased@x", Enable: true,
|
|
ID: "bbbbbbbb-1111-2222-3333-555555555555", SubID: "group-rebased",
|
|
}
|
|
db := database.GetDB()
|
|
var inject sync.Once
|
|
const callback = "test:concurrent-settings-before-grouped-write"
|
|
if err := db.Callback().Query().After("gorm:query").Register(callback, func(tx *gorm.DB) {
|
|
read, ok := tx.Statement.Dest.(*model.Inbound)
|
|
if ok && read.Id == changed.Id && read.Settings == changed.Settings {
|
|
// VLESS preparation omits settings. The first full read is under the mutation lock.
|
|
inject.Do(func() {
|
|
_ = tx.AddError(db.Model(&model.Inbound{}).Where("id = ?", changed.Id).
|
|
Update("settings", `{"clients":[],"decryption":"none"}`).Error)
|
|
})
|
|
}
|
|
}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Cleanup(func() { _ = db.Callback().Query().Remove(callback) })
|
|
_, createErr := svc.Create(inboundSvc, &ClientCreatePayload{
|
|
Client: client, InboundIds: []int{changed.Id, inbounds[1].Id},
|
|
})
|
|
if createErr != nil {
|
|
t.Fatal(createErr)
|
|
}
|
|
for _, inbound := range inbounds {
|
|
if c, ok := settingsClient(t, inbound.Id, client.Email); !ok || c.ID != client.ID {
|
|
t.Fatalf("master lost grouped client in inbound %d: %+v", inbound.Id, c)
|
|
}
|
|
}
|
|
stored, err := inboundSvc.GetInbound(changed.Id)
|
|
if err != nil || !strings.Contains(stored.Settings, `"decryption": "none"`) {
|
|
t.Fatalf("master lost concurrent settings change: %+v, %v", stored, err)
|
|
}
|
|
peer.mu.Lock()
|
|
adds := slices.Clone(peer.adds)
|
|
delivered := peer.settings[101]
|
|
peer.mu.Unlock()
|
|
if len(adds) != 1 || !slices.Equal(adds[0].InboundIds, []int{101, 102}) || adds[0].Client.Email != client.Email ||
|
|
strings.Contains(delivered, "decryption") || !strings.Contains(delivered, client.Email) {
|
|
t.Fatalf("grouped add was not limited to the new client: %+v, peer settings %s", adds, delivered)
|
|
}
|
|
for range 2 {
|
|
if err := inboundSvc.ReconcileNode(t.Context(), remote, node); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
peer.mu.Lock()
|
|
defer peer.mu.Unlock()
|
|
if !slices.Equal(peer.updates, []int{101}) || peer.settings[101] != stored.Settings {
|
|
t.Fatalf("reconcile updates=%v settings=%s, want exactly one repair of inbound 101", peer.updates, peer.settings[101])
|
|
}
|
|
}
|