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
Branch
WriteNameTest
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 9798
Build 17469: Default Diff Build & Tests
Build 17468: arc lint + arc unit

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

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

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