DNS test harness (Deckard)
Deckard is a DNS software testing tool that creates a controlled network environment for reproducible tests.
In essence, it works like this:
- Deckard runs given binaries as subprocesses in an isolated network environment.
- When binaries are up, Deckard sends scripted queries and checks replies.
- When a binary attempts to contact another server, Deckard intercepts the communication and replies with scripted answer.
- Deckard can simulate network issues, DNS environment changes, and fake time (for DNSSEC validation tests).
No changes to real network setup are required because all network communications are made in a network namespace.
Test cases are described by scenarios that contain:
- A declarative description of the environment (e.g. what queries can the binary under test make and what Deckard should answer)
- A sequence of queries (and expected answers), and other events (e.g. time jumps forward)
Requirements
Deckard requires following software to be installed:
- Python >= 3.6
- Linux kernel >= 3.8
- augeas - library for editing configuration files
- dnspython - DNS library for Python
- Jinja2 - template engine for generating config files
- PyYAML - YAML parser for Python
- python-augeas - Python bindings for augeas API
- pytest - testing framework for Python, used for running the test cases
- pytest-xdist - module for pytest for distributed testing
- pytest-forked - module for pytest for testing in forked subprocesses
- pyroute2 - Python netlink library (managing IP addresses, routes,…)
- dumpcap - command line tool for network capture (part of Wireshark)
- faketime_ - used for faking the time in tests of DNSSEC
Compatibility
Deckard uses user and network namespaces to simulate the network environment so only Linux (with kernel version 3.8 or newer) is supported. It however is possible to run Deckard on other platforms in Docker. Just note that your container has to run as --priviledged for the namespaces to run properly.
Usage
- User guide describes how to run tests on a binary.
- Scenario guide describes how to write a new test.
- Devel guide contains some tips for Deckard developers.
License
See LICENSE file.
Acknowledgments
The test scenario design and a lot of tests were written by NLnet Labs for testbound
suite used by Unbound (BSD licensed). We are grateful that testbound
authors are willing to discuss further Deckard development.
The original test case format is described in the header file replay.h distributed with Unbound.
Contacting us
Please report problems to our GitLab: https://gitlab.nic.cz/knot/deckard/issues
If you have any comments feel free to send e-mail to knot-resolver@labs.nic.cz! Do not get confused by the name, we are happy if you want to use Deckard with any software.
Happy testing.