Github user d2r commented on a diff in the pull request:
https://github.com/apache/incubator-storm/pull/164#discussion_r15115148
--- Diff: storm-core/test/clj/backtype/storm/supervisor_test.clj ---
@@ -352,3 +352,98 @@
;; TODO just do reassign, and check that cleans up worker states after
killing but doesn't get rid of downloaded code
)
+(defn found?
+ [sub-str input-str]
+ (if (string? input-str)
+ (.contains input-str sub-str)
+ (some? #(.substring % sub-str) input-str)))
+
+(defn not-found?
+ [sub-str input-str]
+ (complement (found? sub-str input-str)))
+
+(deftest test-substitute-childopts-happy-path
+ (testing "worker-launcher replaces ids in childopts"
+ (let [ worker-id "w-01"
+ storm-id "s-01"
+ port 9999
+ childopts
"-Xloggc:/home/y/lib/storm/current/logs/gc.worker-%ID%-%STORM-ID%-%WORKER-ID%-%WORKER-PORT%.log"
+ ]
+ (def childopts-with-ids (supervisor/substitute-childopts childopts
worker-id storm-id port))
+ (is (not-found? "%WORKER-ID%" childopts-with-ids))
--- End diff --
Let's just test for the expected string here. The way it is now, we are
not testing that substitutions are happening in the right places, and that the
string is otherwise unchanged besides the substitutions. Likewise with the
tests below.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---