@@ -202,21 +202,27 @@ func TestBuildDesiredRecordSet_RecordContents(t *testing.T) {
202202}
203203
204204func TestEncodeDecodeIrohClusterLabel (t * testing.T ) {
205- tests := []string {
206- "" ,
207- "/test-project-staging" ,
208- "/zachs-project-z5pegw" ,
209- "plain-no-slashes" ,
210- "/with/multiple/slashes" ,
211- }
212- for _ , want := range tests {
213- t .Run (want , func (t * testing.T ) {
214- got := decodeIrohClusterLabel (encodeIrohClusterLabel (want ))
215- if got != want {
205+ // Modern (slash-less) cluster names round-trip exactly.
206+ for _ , want := range []string {"" , "test-project-staging" , "zachs-project-z5pegw" , "plain-no-slashes" } {
207+ t .Run ("roundtrip/" + want , func (t * testing.T ) {
208+ if got := decodeIrohClusterLabel (encodeIrohClusterLabel (want )); got != want {
216209 t .Errorf ("round-trip mismatch: encode(%q) -> decode = %q" , want , got )
217210 }
218211 })
219212 }
213+
214+ // Labels written before #196 carried a leading slash; decode strips it so
215+ // they resolve to the slash-less name the provider now engages.
216+ for label , want := range map [string ]string {
217+ "cluster-_test-project-staging" : "test-project-staging" ,
218+ "cluster-_zachs-project-z5pegw" : "zachs-project-z5pegw" ,
219+ } {
220+ t .Run ("legacy/" + label , func (t * testing.T ) {
221+ if got := decodeIrohClusterLabel (label ); got != want {
222+ t .Errorf ("decodeIrohClusterLabel(%q) = %q, want %q" , label , got , want )
223+ }
224+ })
225+ }
220226}
221227
222228func TestBuildDesiredRecordSet_RelayOnlyOmitsAddrEntry (t * testing.T ) {
0 commit comments