IntegrationTests » History » Revision 2
Revision 1 (Junxiao Shi, 06/07/2015 08:13 AM) → Revision 2/3 (Junxiao Shi, 09/02/2015 01:34 PM)
# NFD Integration Tests NFD integration tests are a set of test cases in which one or more NFD instances are executed in a topology of virtual or physical machines, and tested with simple applications. **Integration tests repository:** [Gerrit/NFD/integration-tests](http://gerrit.named-data.net/#/admin/projects/NFD/integration-tests) Integration tests focus on correctness rather than performance. They supplement unit tests. The difference between unit tests and integration tests is: a unit test case executes a module of NFD, and all inputs must be written as test code; an integration test scenario executes one or more full NFD instances, and inputs are generated from simple applications such as [ndnping](https://github.com/named-data/ndn-tools/tree/master/tools/ping) and the [traffic generator](https://github.com/named-data/ndn-traffic-generator). The ability to execute full NFD instances and applications enables an integration test scenario to cover features that are hard to test with unit tests. ## Scenarios Main Article: [[IntegrationScenarios]] Most integration test scenarios fit in one of these categories: * tool test: test tools used in scenarios, such as `nfd-status`, `ndnping`, etc. * face test: test face implementations, such as UNIX socket face, UDP tunnel, etc. * forwarding test: test forwarding behavior, such as FIB matching, [[ScopeControl]], etc. * management test: test management protocol implementations, such as [[HubDiscovery]], remote prefix registration, etc. ## Running To run integration tests: 1. clone integration-tests repository 2. build a topology according to [multi-hosts.conf](http://gerrit.named-data.net/gitweb?p=NFD/integration-tests.git;a=blob;f=multi-host.conf;hb=refs/heads/master) using Ubuntu 14.04 12.04 64-bit virtual or physical machines * ensure every host can access Internet using a NIC separate from the NICs in the topology * enable SSH public key authentication; use same username on all machines * enable password-less sudo for the username * assign IPv4 and IPv6 addresses to each NIC, write assigned IPs into `multi-hosts.conf` * enable IPv4/IPv6 forwarding on node R, disable IPv4/IPv6 forwarding on other nodes * enable SSH public key authentication; use same username on all machines * populate `$HOME/.ssh/known_hosts` on node A so that `ssh <IP-of-B/C/D>` does not require manual host key verification * enable password-less sudo for the username 3. copy the repository including modified `multi-hosts.conf` onto every host 4. on every host, execute `./install_apps.py install_all` 5. on node A, execute `./run_tests.py test_all` NFD integration tests are known to work on VirtualBox VMs and on Emulab emulation platform, VirtualBox VMs, and Vagrant with VirtualBox provider. platform. There are efforts to make them work on OpenVZ virtualization platform and mini-ndn emulator. ## Development To develop a new integration test scenario `foo`, create a directory `test_foo`, and write the scenario as a Python unit test suite. If desired, Python test code may invoke a non-Python script (eg. bash script) to perform the actual test. The scenario may create log files under `test_foo/logs` subdirectory. If the same scenario is executed multiple times for different arguments (eg. test forwarding with different strategy settings), it's recommended to name the log files such that they are not overwritten when the scenario is executed with different arguments. Code shared among multiple scenarios should be placed in `library_helpers` directory. Code used to install dependencies on all nodes should be placed in `install_helpers` directory.