diff options
author | Johan Björk <jbjoerk@gmail.com> | 2012-10-24 12:10:45 -0400 |
---|---|---|
committer | Sasa Zivkov <sasa.zivkov@sap.com> | 2012-10-25 15:30:54 +0200 |
commit | 2119f05af4009b1a6e7d064a872326a988d70008 (patch) | |
tree | 849e7a79aac82b9642dabe9893b9762be08ec99b | |
parent | 473db3d75a6b63eb2e3f094c53d6d5d000db5940 (diff) |
Documentation: Add link to test-submit-rule from the prolog cookbook.
Change-Id: Ib03fa72f16c2cb20c6fa17685890fdbe05dafe9e
-rw-r--r-- | Documentation/prolog-cookbook.txt | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Documentation/prolog-cookbook.txt b/Documentation/prolog-cookbook.txt index 105929a40e..08626bae2f 100644 --- a/Documentation/prolog-cookbook.txt +++ b/Documentation/prolog-cookbook.txt @@ -48,10 +48,8 @@ For interactive testing and playing with Prolog, Gerrit provides the link:pgm-prolog-shell.html[prolog-shell] program which opens an interactive Prolog interpreter shell. -NOTE: It is currently *not possible* to test a Prolog program which implements -Gerrit submit rules using the link:pgm-prolog-shell.html[prolog-shell] program. -The reason is that the Prolog environment that exposes facts about a change -requires a lot of Gerrit server environment to be loaded and running. +NOTE: The interactive shell is just a prolog shell, it does not load +a gerrit server environment and thus is not intended for xref:TestingSubmitRules[testing submit rules]. SWI-Prolog ---------- @@ -249,6 +247,18 @@ NOTE: If `MyProject` doesn't define its own `submit_rule` Gerrit will invoke the default implementation of submit rule that is named `gerrit:default_submit` and its result will be filtered as described above. +[[TestingSubmitRules]] +Testing submit rules +-------------------- +The prolog environment running the `submit_rule` is loaded with state describing the +change that is being evaluated. The easiest way to load this state is to test your +`submit_rule` against a real change on a running gerrit instance. The command +link:cmd-test-submit-rule.html[test-submit-rule] loads a specific change and executes +the `submit_rule`. It optionally reads the rule from from `stdin` to facilitate easy testing. + +==== + cat rules.pl | ssh gerrit_srv gerrit test-submit-rule I45e080b105a50a625cc8e1fb5b357c0bfabe6d68 -s +==== Prolog vs Gerrit plugin for project specific submit rules --------------------------------------------------------- |