- /config delivery now targets the service's dedicated Maestro peer listener: https + authmgmt.MaestroTransport() (Maestro's own mTLS identity, never downgraded in dev), port from org.dcntrlized.peer_port label (default 9443) - extract peerPort() label resolver + unit test - expose MaestroTransport() on authmgmt for orchestrator-only edges - spec + comments updated to describe the gated peer edge
39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
// Copyright (C) 2026 Dcntrlized
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
package containers
|
|
|
|
import "testing"
|
|
|
|
func TestPeerPort(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
labels map[string]string
|
|
want string
|
|
}{
|
|
{"nil labels fall back to default", nil, defaultPeerPort},
|
|
{"empty labels fall back to default", map[string]string{}, defaultPeerPort},
|
|
{"label present wins", map[string]string{"org.dcntrlized.peer_port": "9000"}, "9000"},
|
|
{"empty label value falls back to default", map[string]string{"org.dcntrlized.peer_port": ""}, defaultPeerPort},
|
|
{"unrelated labels fall back to default", map[string]string{"org.dcntrlized.port": "8080"}, defaultPeerPort},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := peerPort(tt.labels); got != tt.want {
|
|
t.Fatalf("peerPort(%v) = %q, want %q", tt.labels, got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
} |