blob: 22b6da654a4a98e0cc1cd2c918d265ea5f625aae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package funcs
import (
"testing"
"github.com/hairyhenderson/gomplate/v3/aws"
"github.com/stretchr/testify/assert"
)
func TestNSIsIdempotent(t *testing.T) {
left := AWSNS()
right := AWSNS()
assert.True(t, left == right)
}
func TestAWSFuncs(t *testing.T) {
m := aws.NewDummyEc2Meta()
i := aws.NewDummyEc2Info(m)
af := &Funcs{meta: m, info: i}
assert.Equal(t, "unknown", must(af.EC2Region()))
assert.Equal(t, "", must(af.EC2Meta("foo")))
assert.Equal(t, "", must(af.EC2Tag("foo")))
assert.Equal(t, "unknown", must(af.EC2Region()))
}
func must(r interface{}, err error) interface{} {
if err != nil {
panic(err)
}
return r
}
|