IntegrationTests » History » Version 3
Davide Pesavento, 01/03/2023 02:14 AM
1 | 1 | Junxiao Shi | # NFD Integration Tests |
---|---|---|---|
2 | |||
3 | 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. |
||
4 | |||
5 | 3 | Davide Pesavento | **Integration tests repository:** [Gerrit/NFD/integration-tests](http://gerrit.named-data.net/#/admin/projects/NFD/integration-tests) |
6 | 1 | Junxiao Shi | |
7 | Integration tests focus on correctness rather than performance. |
||
8 | They supplement unit tests. |
||
9 | The difference between unit tests and integration tests is: |
||
10 | a unit test case executes a module of NFD, and all inputs must be written as test code; |
||
11 | 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). |
||
12 | 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. |
||
13 | |||
14 | ## Scenarios |
||
15 | |||
16 | Main Article: [[IntegrationScenarios]] |
||
17 | |||
18 | Most integration test scenarios fit in one of these categories: |
||
19 | |||
20 | * tool test: test tools used in scenarios, such as `nfd-status`, `ndnping`, etc. |
||
21 | * face test: test face implementations, such as UNIX socket face, UDP tunnel, etc. |
||
22 | * forwarding test: test forwarding behavior, such as FIB matching, [[ScopeControl]], etc. |
||
23 | * management test: test management protocol implementations, such as [[HubDiscovery]], remote prefix registration, etc. |
||
24 | |||
25 | ## Running |
||
26 | |||
27 | To run integration tests: |
||
28 | |||
29 | 1. clone integration-tests repository |
||
30 | 2 | Junxiao Shi | 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 64-bit virtual or physical machines |
31 | 1 | Junxiao Shi | * ensure every host can access Internet using a NIC separate from the NICs in the topology |
32 | * assign IPv4 and IPv6 addresses to each NIC, write assigned IPs into `multi-hosts.conf` |
||
33 | * enable IPv4/IPv6 forwarding on node R, disable IPv4/IPv6 forwarding on other nodes |
||
34 | 2 | Junxiao Shi | * enable SSH public key authentication; use same username on all machines |
35 | * populate `$HOME/.ssh/known_hosts` on node A so that `ssh <IP-of-B/C/D>` does not require manual host key verification |
||
36 | * enable password-less sudo for the username |
||
37 | 1 | Junxiao Shi | 3. copy the repository including modified `multi-hosts.conf` onto every host |
38 | 4. on every host, execute `./install_apps.py install_all` |
||
39 | 5. on node A, execute `./run_tests.py test_all` |
||
40 | |||
41 | 2 | Junxiao Shi | NFD integration tests are known to work on Emulab emulation platform, VirtualBox VMs, and Vagrant with VirtualBox provider. |
42 | 1 | Junxiao Shi | There are efforts to make them work on OpenVZ virtualization platform and mini-ndn emulator. |
43 | |||
44 | ## Development |
||
45 | |||
46 | To develop a new integration test scenario `foo`, create a directory `test_foo`, and write the scenario as a Python unit test suite. |
||
47 | If desired, Python test code may invoke a non-Python script (eg. bash script) to perform the actual test. |
||
48 | |||
49 | The scenario may create log files under `test_foo/logs` subdirectory. |
||
50 | 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. |
||
51 | |||
52 | Code shared among multiple scenarios should be placed in `library_helpers` directory. |
||
53 | Code used to install dependencies on all nodes should be placed in `install_helpers` directory. |