You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2014/06/23 17:19:29 UTC

[18/22] git commit: Add testing best practices to DEVELOPER.md

Add testing best practices to DEVELOPER.md


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/e08fb066
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/e08fb066
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/e08fb066

Branch: refs/heads/security
Commit: e08fb0663fab9d24bd8a4e74cd41aef94e5cb7ac
Parents: 5c82b9f
Author: Michael G. Noll <mi...@apache.org>
Authored: Mon Jun 23 11:19:36 2014 +0200
Committer: Michael G. Noll <mi...@apache.org>
Committed: Mon Jun 23 11:19:36 2014 +0200

----------------------------------------------------------------------
 DEVELOPER.md | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/e08fb066/DEVELOPER.md
----------------------------------------------------------------------
diff --git a/DEVELOPER.md b/DEVELOPER.md
index 7d1c09c..22019b6 100644
--- a/DEVELOPER.md
+++ b/DEVELOPER.md
@@ -19,6 +19,8 @@ Table of Contents
         * <a href="#merge-pull-request">Merge a pull request or patch</a>
     * <a href="#building">Build the code and run the tests</a>
     * <a href="#packaging">Create a Storm distribution (packaging)</a>
+* <a href="#best-practices">Best practices</a>
+    * <a href="#best-practices-testing">Testing</a>
 * <a href="#tools">Tools</a>
     * <a href="#code-repositories">Source code repositories (git)</a>
     * <a href="#issue-tracking">Issue tracking (JIRA)</a>
@@ -262,6 +264,26 @@ You can verify whether the digital signatures match their corresponding files:
     $ gpg --verify storm-dist/binary/target/apache-storm-<version>.tar.gz.asc
 
 
+<a name="best-practices"></a>
+
+# Best practices
+
+
+<a name="best-practices-testing"></a>
+
+## Testing
+
+Tests should never rely on timing in order to pass.  In Storm can properly test functionality that depends on time by
+simulating time, which means we do not have to worry about e.g. random delays failing our tests indeterministically.
+
+If you are testing topologies that do not do full tuple acking, then you should be testing using the "tracked
+topologies" utilities in `backtype.storm.testing.clj`.  For example,
+[test-acking](storm-core/test/clj/backtype/storm/integration_test.clj) (around line 213) tests the acking system in
+Storm using tracked topologies.  Here, the key is the `tracked-wait` function: it will only return when both that many
+tuples have been emitted by the spouts _and_ the topology is idle (i.e. no tuples have been emitted nor will be emitted
+without further input).  Note that you should not use tracked topologies for topologies that have tick tuples.
+
+
 <a name="tools"></a>
 
 # Tools