Heron uses Bazel for building and running unit tests. Before running tests, first set up your build environment as described in Compiling Heron.

Running Unit Tests

The following command will run all tests:

$ bazel test --config=darwin heron/...

To run a specific test target, pass the test target name.

$ bazel test --config=darwin heron/statemgrs/tests/java:localfs-statemgr_unittest

Discovering Unit Test Targets

To see a full listing of all Bazel test targets:

$ bazel query 'kind(".*_test rule", ...)'

For Java targets only:

$ bazel query 'kind("java_test rule", ...)'

For C++ targets:

$ bazel query 'kind("cc_test rule", ...)'

For Python targets:

$ bazel query 'kind("pex_test rule", ...)'

Running Integration Tests

Integration tests are divided into two categories:

  • Functional integration tests

    These integration tests are designed for testing the functionality of Heron, such as topologies and groupings. To run the functional integration tests on a Mac OS X, do the following:

    $ ./scripts/run_integration_test.sh
    
  • Failure integration tests

    These integration tests are designed for testing recovery from failure/restart in certain processes, such as Topology Master and Metrics Manager. To run the failure integration tests on a Mac OS X, do the following:

    $ bazel build --config=darwin integration-test/src/...
    $ ./bazel-bin/integration-test/src/python/local_test_runner/local-test-runner