Skip to content

Latest commit

 

History

History
78 lines (51 loc) · 2.85 KB

README.md

File metadata and controls

78 lines (51 loc) · 2.85 KB

Testing & dd-agent

Build Status Build status

Lint

Your code should always be clean when doing rake lint. It runs flake8, ignoring these rules.

Organisation of the tests directory

tests
├── checks # tests of checks.d/*
│   ├── integration # contains all real integration tests (run on Travis/Appveyor)
│   ├── mock # contains mocked tests (run on Travis)
│   └── fixtures # files needed by tests (conf files, mocks, ...)
└── core # core agent tests (unit and integration tests, run on Travis)
    └── fixtures # files needed by tests

We use rake & nosetests to manage the tests.

To run individual tests:

# Whole file
nosetests tests/checks/mock/test_system_swap.py
# Whole class
nosetests tests/checks/mock/test_system_swap.py:SystemSwapTestCase
# Single test case
nosetests tests/checks/mock/test_system_swap.py:SystemSwapTestCase.test_system_swap

To run a specific ci flavor (our way of splitting tests, for more details see integration tests):

# Run the flavor my_flavor
rake ci:run[my_flavor]

Unit tests

They are split in different flavors:

# Run the mock/unit core tests
rake ci:run

# Run mock/unit checks tests
rake ci:run[checks_mock]

# Agent core integration tests (can take more than 5min)
rake ci:run[core_integration]

Integration tests

All integrations, except for the kubernates and docker ones, have been moved to the Integration SDK. Please look there to see the Integrations Tests.

Travis

Its configuration is stored in .travis.yml.

It's running the exact same command described above (rake ci:run[flavor]), with the restriction of one flavor + version per build. (we use the build matrix to split flavors)

We use the newly released docker-based infrastructure.

Appveyor

Its configuration is stored in appveyor.yml.

It's using the same command as Travis, rake ci:run[flavor], but runs only tests with the windows attr: @attr('windows', requires='flavor'). It tests only Windows-specific checks, with python 2.7 (32 and 64 bits).

Third parties softwares are not build from source, instead it uses pre-installed programs.

Appveyor is caching gems & pywin32 exe (needed for WMI), there is no custom caching.