Support multiple CarrierNode instances in carriernodeclient/coreconfig/mediacore
ProjectConfigurator's Projects workspace already lets an operator register more than one CarrierNode instance (separate storage backends, HA/failover replicas, or a mix), but every consumer only ever read a single carriernode_url. Add carriernodeclient.NewMulti (ListFiles merges across instances, Probe/ FetchToScratch/ProbeMedia try each in order, writes stay primary-only), coreconfig.Info.CarrierNodeURLs for pushed consumers, and mediacore.CarrierNodeURLs for the 7 services that read settings directly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
87ac5ed25a
commit
9f78995d03
5 files changed
+434
-42
No files matched your search
@@ -63,6 +63,44 @@ func TestHandlerRejectsMissingOrWrongSecret(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStoreSetPopulatesCarrierNodeURLsFromLegacyField(t *testing.T) {
|
||||
store := NewStore(Info{})
|
||||
|
||||
store.Set(Info{CarrierNodeURL: "http://carrier.example.com"})
|
||||
|
||||
got := store.Get()
|
||||
if want := []string{"http://carrier.example.com"}; !equalStrings(got.CarrierNodeURLs, want) {
|
||||
t.Fatalf("CarrierNodeURLs = %v, want %v", got.CarrierNodeURLs, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStoreSetCarrierNodeURLsAlsoUpdatesPrimary(t *testing.T) {
|
||||
store := NewStore(Info{})
|
||||
|
||||
store.Set(Info{CarrierNodeURLs: []string{"http://primary.example.com", "http://replica.example.com"}})
|
||||
|
||||
got := store.Get()
|
||||
if got.CarrierNodeURL != "http://primary.example.com" {
|
||||
t.Fatalf("CarrierNodeURL = %q, want first CarrierNodeURLs entry", got.CarrierNodeURL)
|
||||
}
|
||||
want := []string{"http://primary.example.com", "http://replica.example.com"}
|
||||
if !equalStrings(got.CarrierNodeURLs, want) {
|
||||
t.Fatalf("CarrierNodeURLs = %v, want %v", got.CarrierNodeURLs, want)
|
||||
}
|
||||
}
|
||||
|
||||
func equalStrings(got, want []string) bool {
|
||||
if len(got) != len(want) {
|
||||
return false
|
||||
}
|
||||
for i := range got {
|
||||
if got[i] != want[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func TestHandlerAppliesPushedInfo(t *testing.T) {
|
||||
store := NewStore(Info{})
|
||||
handler := Handler("s3cret", store)
|
||||
|
||||
Reference in new issue
Block a user