The short story =============== Install the mini cluster (only once): ``` $ ./tools/jenkins/jenkins.sh slow ``` Run all the tests: ``` $ build/env/bin/hue test all ``` Or just some parts of the tests, e.g.: ``` $ build/env/bin/hue test specific impala $ build/env/bin/hue test specific impala.tests:TestMockedImpala $ build/env/bin/hue test specific impala.tests:TestMockedImpala.test_basic_flow ``` Jasmine tests (from your browser): http://localhost:8000/jasmine Longer story ============ The ``test`` management command prepares the arguments (test app names) and passes them to nose (django_nose.nose_runner). Nose will then magically find all the tests to run. Tests themselves should be named *_test.py. These will be found as long as they're in packages covered by django. You can use the unittest frameworks, or you can just name your method with the word "test" at a word boundary, and nose will find it. See apps/hello/src/hello/hello_test.py for an example. Helpful command-line tricks =========================== To run tests that do not depend on Hadoop, use: build/env/bin/hue test fast To run all tests, use: build/env/bin/hue test all To run only tests of a particular app, use: build/env/bin/hue test specific E.g. build/env/bin/hue test specific filebrowser To run a specific test, use: build/env/bin/hue test specific E.g. build/env/bin/hue test specific useradmin.tests:test_user_admin Start up pdb on test failures: build/env/bin/hue test --pdb --pdb-failure -s Point to an Impalad and trigger the Impala tests: build/env/bin/hue test impala impalad-01.gethue.com Run the Jasmine tests ===================== * NodeJS (https://nodejs.org/) * PhantomJS (npm install -g phantomjs-prebuilt) Special environment variables ============================= DESKTOP_LOGLEVEL= level can be DEBUG, INFO, WARN, ERROR, or CRITICAL When specified, the console logger is set to the given log level. A console logger is created if one is not defined. DESKTOP_DEBUG A shorthand for DESKTOP_LOG_LEVEL=DEBUG. Also turns on output HTML validation. DESKTOP_PROFILE Turn on Python profiling. The profile data is saved in a file. See the console output for the location of the file. DESKTOP_LOG_DIR= Specify the HUE log directory. Defaults to ./log. DESKTOP_DB_CONFIG= Specify alternate DB connection parameters for HUE to use. Useful for testing your changes against, for example, MySQL instead of sqlite. String is a colon-delimited list. TEST_IMPALAD_HOST=impalad-01.gethue.com Point to an Impalad and trigger the Impala tests. Writing tests that depend on Hadoop =================================== Use pseudo_hdfs4.py! You should tag such tests with "requires_hadoop", as follows: from nose.plugins.attrib import attr @attr('requires_hadoop') def your_test(): ... Hudson Configuration ==================== Because building Hadoop (for the tests that require it) is slow, we've separated the Hudson builds into "fast" and "slow". Both are run via scripts/hudson.sh, which should be kept updated with the latest and greatest in build technologies. Headless Windmill ================= Ideally, all you need to do is install xvfb and run "xvfb-run bin/hue test_windmill". To debug, however, you'll need to be able to check out what's going on. You can run "xvfb-run bash", followed by "x11vnc", and then connect to your X via VNC from another machine. This lets you eavesdrop nicely.