Greenplum OSS

Greenplum Utility testing with behave

The management utilities have a set of tests with them used to make sure things like gpinitsystem, gpcheck and analyzedb are functioning properly.

There is a README file in the source code that talks about how to make this happen using the behave framework, but I wanted to additionally break it down in a blog post.

Let’s say for instance I would like to make a change to gpinitsystem as a developer, then running the gpinitsystem behave tests would make sense in order to validate the way the program is executing in the way we expect it.

It should be no surprise that the first step is you need to have the behave python module installed, this is pretty simple:

sudo pip install behave

additionally you’ll want to have sourced the environment variables for the files you have compiled (note your path may be different)

source /usr/local/gpdb/

At that point in order to execute the tests for something like gpinitsystem, you want to make sure you are in the proper directory

cd ~/gpdb_build/gpdb/gpMgmt

and then use behave to execute the test

behave test/behave/mgmt_utils/gpinitsystem.feature

and it will run through the tests

if I want to execute a specific test I can pass a tag to just run tests that match the tag

behave test/behave/mgmt_utils/gpinitsystem.feature --tags gpinitsystem_verify_timezone_setting