console remote instances: channelHosts test covers each record family's listing failing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+14
−6
internal/console/remoteinstances_test.go+14 −6
diff --git a/internal/console/remoteinstances_test.go b/internal/console/remoteinstances_test.go| index 8b6b4120f..9fb54ec8f 100644 |
| --- a/internal/console/remoteinstances_test.go |
| +++ b/internal/console/remoteinstances_test.go |
| @@ -573,17 +573,25 @@ func TestChannelHostsCountsRemoteFollowers(t *testing.T) { |
| if err != nil || len(hosts) != 1 || hosts[0] != provision.SidecarHost("bot", "shop", tb.sqid) { |
| t.Fatalf("canary/side followers = %v %v, want the sidecar", hosts, err) |
| } |
| - // A failing bucket is an error, never "nobody". |
| - tb.fx.srv.cfg.Releases = remoteFailingRecordStore{tb.fx.rel} |
| - if hosts, err := tb.fx.srv.channelHosts(context.Background(), tb.sqid, "shop", "canary/rc"); err == nil { |
| - t.Fatalf("channelHosts over a failing bucket = %v, nil error", hosts) |
| + // A failing listing, of either family, is an error, never "nobody". |
| + live := tb.fx.srv.cfg.Releases |
| + for _, family := range []string{"/instances/", "/sidecars/"} { |
| + tb.fx.srv.cfg.Releases = remoteFailingRecordStore{live, family} |
| + if hosts, err := tb.fx.srv.channelHosts(context.Background(), tb.sqid, "shop", "canary/rc"); err == nil { |
| + t.Fatalf("channelHosts with %s failing = %v, nil error", family, hosts) |
| + } |
| } |
| + tb.fx.srv.cfg.Releases = live |
| } |
| -type remoteFailingRecordStore struct{ release.Store } |
| +// remoteFailingRecordStore fails every listing under one record family. |
| +type remoteFailingRecordStore struct { |
| + release.Store |
| + family string |
| +} |
| func (s remoteFailingRecordStore) List(ctx context.Context, prefix string) ([]string, error) { |
| - if strings.Contains(prefix, "/instances/") || strings.Contains(prefix, "/sidecars/") { |
| + if strings.Contains(prefix, s.family) { |
| return nil, fmt.Errorf("boom") |
| } |
| return s.Store.List(ctx, prefix) |