Files
git-upstream/functional-tests
Davide Guerri 24df2f38af Add drop and supersede commands
* supersede command allows the marking of commits as superceded by a
  set of upstream changes
* drop command allows the marking of commits that should be dropped

Both commands add git notes to a given sha1 in the upstream-merge
namespace (refs/notes/upstream-merge).
The notes are read by the import-upstream command during import and
the appropriate actions are then taken.

Add functional and unit tests for the two newly created commands.

JIRA: CICD-248
Change-Id: I6f69dd890af18e77a9affdb958afde1ec8b1cab8
2014-02-17 15:03:49 +00:00
..

How to run

Just run

run_tests.sh

That script will install a virtual env with hpgit (from the current repo clone) and will run every script which name match the following regex:

([0-9]{3})-test_(.+).sh

Order of execution is given by $1 and test name by $2.

It's also possible to run single tests creating a test directory and running

BASE_TEST_DIR=<your base test dir> 0xx-test_<your test name>.sh

But that will need a git-hp executable in yout path.

Creating more tests

Simply copy

sample-test_name_here.sh

giving it a name that matches the aforementioned regexp.

Then edit the file definig a function that performs the actual test

function test_name1() {
  log DEBUG "Starting $TEST_NAME::$FUNCNAME"

  return 0
}

Leave rest of the code as it is.

Reference of global variables/functions available in this framework

logging.lib

set_verbority() Set verbosity level. Available verbosities are: "ERROR WARNING INFO DEBUG"

log() Print the given string, with a decoration, if current verbosity level is less or equal to the one passed as an argument.

utils.lib

TEST_DIR Testing directory. Objects pertaining a test should be created under that directory.

TEST_NAME The name of current test. Extracted from the test filename.

prepare_for_hpgit() Using the current hpgit repo, create an initial configuration useful for testing hp-git. After invoking it a "$TEST_DIR/$REPO_NAME"

Environment variable used by the test framework

VERBOSITY Set tests verbosity. Valid verbosities are: "ERROR WARNING INFO DEBUG"

LEAVE_DIR If equals to "yes", testing framework won't remove testing directory. Useful for debugging and to inspect tests results.