cmd/devp2p: fix comparison of TXT record value (#22572)
* cmd/devp2p: fix comparison of TXT record value The AWS API returns quoted DNS strings, so we must encode the new value before comparing it against the existing record content. * cmd/devp2p: add test * cmd/devp2p: fix typo and rename val -> newValue
This commit is contained in:
		| @@ -162,5 +162,29 @@ func TestRoute53ChangeSort(t *testing.T) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // This test checks that computeChanges compares the quoted value of the records correctly. | ||||
| func TestRoute53NoChange(t *testing.T) { | ||||
| 	// Existing record set. | ||||
| 	testTree0 := map[string]recordSet{ | ||||
| 		"n": {ttl: rootTTL, values: []string{ | ||||
| 			`"enrtree-root:v1 e=JWXYDBPXYWG6FX3GMDIBFA6CJ4 l=C7HRFPF3BLGF3YR4DY5KX3SMBE seq=1 sig=o908WmNp7LibOfPsr4btQwatZJ5URBr2ZAuxvK4UWHlsB9sUOTJQaGAlLPVAhM__XJesCHxLISo94z5Z2a463gA"`, | ||||
| 		}}, | ||||
| 		"2xs2367yhaxjfglzhvawlqd4zy.n": {ttl: treeNodeTTL, values: []string{ | ||||
| 			`"enr:-HW4QOFzoVLaFJnNhbgMoDXPnOvcdVuj7pDpqRvh6BRDO68aVi5ZcjB3vzQRZH2IcLBGHzo8uUN3snqmgTiE56CH3AMBgmlkgnY0iXNlY3AyNTZrMaECC2_24YYkYHEgdzxlSNKQEnHhuNAbNlMlWJxrJxbAFvA"`, | ||||
| 		}}, | ||||
| 	} | ||||
| 	// New set. | ||||
| 	testTree1 := map[string]string{ | ||||
| 		"n":                            "enrtree-root:v1 e=JWXYDBPXYWG6FX3GMDIBFA6CJ4 l=C7HRFPF3BLGF3YR4DY5KX3SMBE seq=1 sig=o908WmNp7LibOfPsr4btQwatZJ5URBr2ZAuxvK4UWHlsB9sUOTJQaGAlLPVAhM__XJesCHxLISo94z5Z2a463gA", | ||||
| 		"2XS2367YHAXJFGLZHVAWLQD4ZY.n": "enr:-HW4QOFzoVLaFJnNhbgMoDXPnOvcdVuj7pDpqRvh6BRDO68aVi5ZcjB3vzQRZH2IcLBGHzo8uUN3snqmgTiE56CH3AMBgmlkgnY0iXNlY3AyNTZrMaECC2_24YYkYHEgdzxlSNKQEnHhuNAbNlMlWJxrJxbAFvA", | ||||
| 	} | ||||
|  | ||||
| 	var client route53Client | ||||
| 	changes := client.computeChanges("n", testTree1, testTree0) | ||||
| 	if len(changes) > 0 { | ||||
| 		t.Fatalf("wrong changes (got %d, want 0)", len(changes)) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func sp(s string) *string { return &s } | ||||
| func ip(i int64) *int64   { return &i } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user