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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « swarming/tasktemplate/template.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package tasktemplate
6
7 import (
8 "testing"
9
10 . "github.com/smartystreets/goconvey/convey"
11 )
12
13 func TestResolve(t *testing.T) {
14 t.Parallel()
15
16 Convey(`Testing substitution resolution`, t, func() {
17 var p Params
18
19 Convey(`With no parameters`, func() {
20 v, err := p.Resolve("foo")
21 So(err, ShouldBeNil)
22 So(v, ShouldEqual, "foo")
23
24 _, err = p.Resolve("${swarming_run_id}")
25 So(err, ShouldNotBeNil)
26
27 _, err = p.Resolve("${undefined}")
28 So(err, ShouldNotBeNil)
29 })
30
31 Convey(`With a "swarming_run_id" parameter defined.`, func() {
32 p.SwarmingRunID = "12345"
33
34 v, err := p.Resolve("foo")
35 So(err, ShouldBeNil)
36 So(v, ShouldEqual, "foo")
37
38 v, err = p.Resolve("${swarming_run_id}")
39 So(err, ShouldBeNil)
40 So(v, ShouldEqual, "12345")
41
42 _, err = p.Resolve("${undefined}")
43 So(err, ShouldNotBeNil)
44 })
45 })
46 }
OLDNEW
« 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