forked from nspcc-dev/neofs-contract
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nspcc-dev#266] nns: Fix CNAME resolution rules
Do not include CNAME to the resulting list if we're looking for another record type. If it's CNAME than it must be resolved. Signed-off-by: Anna Shaleva <[email protected]>
- Loading branch information
1 parent
d3d4a81
commit e3c563d
Showing
2 changed files
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -390,19 +390,29 @@ func TestNNSResolve(t *testing.T) { | |
c := newNNSInvoker(t, true) | ||
|
||
refresh, retry, expire, ttl := int64(101), int64(102), int64(103), int64(104) | ||
c.Invoke(t, true, "register", | ||
"test.com", c.CommitteeHash, | ||
"[email protected]", refresh, retry, expire, ttl) | ||
c.Invoke(t, true, "register", "test.com", c.CommitteeHash, "[email protected]", refresh, retry, expire, ttl) | ||
c.Invoke(t, stackitem.Null{}, "addRecord", "test.com", int64(nns.TXT), "expected result") | ||
c.Invoke(t, stackitem.Null{}, "addRecord", "test.com", int64(nns.CNAME), "alias.com") | ||
|
||
c.Invoke(t, stackitem.Null{}, "addRecord", | ||
"test.com", int64(nns.TXT), "expected result") | ||
c.Invoke(t, true, "register", "alias.com", c.CommitteeHash, "[email protected]", refresh, retry, expire, ttl) | ||
c.Invoke(t, stackitem.Null{}, "addRecord", "alias.com", int64(nns.A), "1.2.3.4") | ||
c.Invoke(t, stackitem.Null{}, "addRecord", "alias.com", int64(nns.CNAME), "alias2.com") | ||
|
||
c.Invoke(t, true, "register", "alias2.com", c.CommitteeHash, "[email protected]", refresh, retry, expire, ttl) | ||
c.Invoke(t, stackitem.Null{}, "addRecord", "alias2.com", int64(nns.A), "5.6.7.8") | ||
|
||
records := stackitem.NewArray([]stackitem.Item{stackitem.Make("expected result")}) | ||
c.Invoke(t, records, "resolve", "test.com", int64(nns.TXT)) | ||
c.Invoke(t, records, "resolve", "test.com.", int64(nns.TXT)) | ||
c.InvokeFail(t, "invalid domain name format", "resolve", "test.com..", int64(nns.TXT)) | ||
|
||
// Empty result. | ||
c.Invoke(t, stackitem.NewArray([]stackitem.Item{}), "resolve", "test.com", int64(nns.CNAME)) | ||
c.Invoke(t, stackitem.NewArray([]stackitem.Item{}), "resolve", "test.com", int64(nns.AAAA)) | ||
|
||
// Check CNAME is properly resolved and is not included into the result list. | ||
c.Invoke(t, stackitem.NewArray([]stackitem.Item{stackitem.Make("1.2.3.4"), stackitem.Make("5.6.7.8")}), "resolve", "test.com", int64(nns.A)) | ||
// And this time it should be properly included without resolution. | ||
c.Invoke(t, stackitem.NewArray([]stackitem.Item{stackitem.Make("alias.com")}), "resolve", "test.com", int64(nns.CNAME)) | ||
} | ||
|
||
func TestNNSAddRecord(t *testing.T) { | ||
|