sparse-intern-71089
12/21/2020, 12:21 PMprehistoric-kite-30979
12/21/2020, 12:21 PMfunc TestTemplate(t *testing.T) {
tests := []struct {
name string
tmpl string
data interface{}
want string
}{
{
name: "Shallow object",
tmpl: "Hello, {{ .Field }}!",
data: struct{ Field pulumi.StringInput }{Field: pulumi.String("world")},
want: "Hello, world!",
},
}
for _, tt := range tests {
var wg sync.WaitGroup
t.Run(tt.name, func(t *testing.T) {
got := Template(tt.tmpl, tt.data)
wg.Add(1)
pulumi.All(got, tt.want).ApplyString(func(args []interface{}) (string, error) {
a := args[0].(string)
b := args[1].(string)
if diff := cmp.Diff(a, b); diff != "" {
t.Error(diff)
}
wg.Done()
return "", nil
})
wg.Wait()
})
}
}
prehistoric-kite-30979
12/21/2020, 12:21 PMprehistoric-kite-30979
12/21/2020, 12:22 PMpulumi up
the fields get populated with the memory addresses.prehistoric-kite-30979
12/21/2020, 12:47 PMpulumi.String()
based input whereas my pulumi up
loads it in from config.prehistoric-kite-30979
12/21/2020, 12:49 PMprehistoric-kite-30979
12/21/2020, 1:11 PMprehistoric-kite-30979
12/21/2020, 3:22 PMToStringOutput()
to my test case.