Skip to content

Commit

Permalink
docs: Additional testing documentation (#8001)
Browse files Browse the repository at this point in the history
* Additional testing documentation

* snmpsim is required for save-test-data.php already

* Update Test-Units.md
  • Loading branch information
murrant authored and laf committed Jan 2, 2018
1 parent 5c5de59 commit 34ed39c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/Developing/os/Test-Units.md
Expand Up @@ -19,6 +19,9 @@ default when running `./scripts/pre-commit.php`.
the --hostname (-h) allows you to capture all data used to discover and poll a device already added to LibreNMS. Make sure to
re-run the script if you add additional support. Check the command-line help for more options.

Generally, you will only need to capture data (-h) once. After you have the data you need in the snmprec file, you can
update the json using -o (and -v if using a variant) after that.

### OS Variants

If test data already exists, but is for a different device/configuration then you should use the --variant (-v) option to
Expand Down Expand Up @@ -82,3 +85,25 @@ Hex encoded strings (4x) should be used for any strings that contain line return
## New discovery/poller modules

New discovery or poller modules should define database capture parameters in `/tests/module_tables.yaml`.

## Example workflow
If the base os (<os>.snmprec) already contains test data for the module you are testing or that data conflicts with your new
data, you must use a variant to store your test data (-v).

### Add initial detection
1. Add device to LibreNMS. It is generic and device_id = 42
2. Run `./scripts/save-test-data.php -h 42 -m os`, initial snmprec will be created
3. [Add initial detection](Initial-Detection.md) for `example-os`
4. Run discovery to make sure it detects properly `./discovery.php -h 42`
5. Add any additional os items like version, hardware, features, or serial.
6. If there is additional snmp data required, run `./scripts/save-test-data.php -h 42 -m os` otherwise, run `./scripts/save-test-data.php -o example-os -m os`
7. Review data. If you modified the snmprec (don't modify json manually) run `./scripts/save-test-data.php -o example-os -m os`
8. Run `./scripts/pre-commit.php --db --snmpsim`
9. If the tests succeed submit a pull request

### Additional module support or test data
1. Add code to support module or support already exists.
2. `./scripts/save-test-data.php -h 42 -m <module>`, this will add more data to the snmprec file
3. Review data. If you modified the snmprec (don't modify json manually) run `./scripts/save-test-data.php -o example-os -m <module>`
4. Run `./scripts/pre-commit.php --db --snmpsim`
5. If the tests succeed submit a pull request

0 comments on commit 34ed39c

Please sign in to comment.