Page MenuHomePhabricator

Add some unit tests for write_name() for seeder
ClosedPublic

Authored by nakihito on Mar 12 2020, 18:08.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rSTAGING3cac51b8198f: Add some unit tests for write_name() for seeder
rABC3cac51b8198f: Add some unit tests for write_name() for seeder
Summary

Adds some unit tests for write_name() in seeder/dns.cpp. This
function, like parse_name() is critical for dns operations and should
have some tests to increase confidence in correct behavior.

Test Plan
ninja check-bitcoin-seeder

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Mar 12 2020, 18:08
deadalnix requested changes to this revision.Mar 13 2020, 07:39
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
src/seeder/dns.h
44 ↗(On Diff #16903)

All these functions being pulled in the header but only used by the test probably indicate that there is an higher level API problem here. This is not meant to be consumed by the application, which indicate dns.cpp probably should be several modules instead of one.

Not something I expect you to fix in that patch, but you need to be thinking about it when you form plans to move forward with this.

src/seeder/test/dns_tests.cpp
267 ↗(On Diff #16903)

It seems like there is very little coupling between this and what comes before. that is a good indication that this should be two tests instead of one dns kitchen sink test.

This revision now requires changes to proceed.Mar 13 2020, 07:39

Split dns_tests.cpp into write_name_tests.cpp and parse_name_tests.cpp, moved CreateDNSQuestionNameField() to dns_util.h.

This revision is now accepted and ready to land.Mar 21 2020, 00:39