Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: swarming/tasktemplate/template_test.go

Issue 2701033003: milo: Add SwarmBucket templating. (Closed)
Patch Set: Apparently "/swarming" is gitignored! Added... Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « swarming/tasktemplate/template.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: swarming/tasktemplate/template_test.go
diff --git a/swarming/tasktemplate/template_test.go b/swarming/tasktemplate/template_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..2bdcced98eec22d2d179e42c1b95d4e86bf84eec
--- /dev/null
+++ b/swarming/tasktemplate/template_test.go
@@ -0,0 +1,46 @@
+// Copyright 2017 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package tasktemplate
+
+import (
+ "testing"
+
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestResolve(t *testing.T) {
+ t.Parallel()
+
+ Convey(`Testing substitution resolution`, t, func() {
+ var p Params
+
+ Convey(`With no parameters`, func() {
+ v, err := p.Resolve("foo")
+ So(err, ShouldBeNil)
+ So(v, ShouldEqual, "foo")
+
+ _, err = p.Resolve("${swarming_run_id}")
+ So(err, ShouldNotBeNil)
+
+ _, err = p.Resolve("${undefined}")
+ So(err, ShouldNotBeNil)
+ })
+
+ Convey(`With a "swarming_run_id" parameter defined.`, func() {
+ p.SwarmingRunID = "12345"
+
+ v, err := p.Resolve("foo")
+ So(err, ShouldBeNil)
+ So(v, ShouldEqual, "foo")
+
+ v, err = p.Resolve("${swarming_run_id}")
+ So(err, ShouldBeNil)
+ So(v, ShouldEqual, "12345")
+
+ _, err = p.Resolve("${undefined}")
+ So(err, ShouldNotBeNil)
+ })
+ })
+}
« no previous file with comments | « swarming/tasktemplate/template.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698