summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2018-05-03 21:50:37 -0400
committerDave Henderson <dhenderson@gmail.com>2018-05-03 22:57:25 -0400
commit6124d3dfd274ac24e5da0817ae172aca58c22d4e (patch)
tree22acb5a6e7bbf59dd1337953445e036b06da94b5 /test
parent195a6dc75ddbc6f4899176d006c6dfba39e08f1a (diff)
Adding datasourceReachable function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/integration/datasources_file_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/integration/datasources_file_test.go b/test/integration/datasources_file_test.go
index 1c8d1530..5703217f 100644
--- a/test/integration/datasources_file_test.go
+++ b/test/integration/datasources_file_test.go
@@ -53,6 +53,15 @@ func (s *FileDatasourcesSuite) TestFileDatasources(c *C) {
result.Assert(c, icmd.Expected{ExitCode: 0, Out: "bar"})
result = icmd.RunCommand(GomplateBin,
+ "-d", "config="+s.tmpDir.Join("config2.yml"),
+ "-i", `{{ if (datasourceReachable "bogus") }}bogus!{{ end -}}
+{{ if (datasourceReachable "config") -}}
+{{ (ds "config").foo -}}
+{{ end }}`,
+ )
+ result.Assert(c, icmd.Expected{ExitCode: 0, Out: "bar"})
+
+ result = icmd.RunCommand(GomplateBin,
"-d", "csv="+s.tmpDir.Join("foo.csv"),
"-i", `{{ index (index (ds "csv") 2) 1 }}`,
)