For simple components this seems pretty straightforward. However, when I go to test a more complex component I can’t figure out how to get it to work. For instance, I have a component that accepts an eks.ClusterOutput as an argument, and the component then makes use of the clusters name (I know I could refactor to pass the name and if it was just that I would) and I can’t see what I need to do.
func TestConstruct(t *testing.T) {
err := pulumi.RunErr(func(ctx *pulumi.Context) error {
cluster, err := eks.NewCluster(ctx, "my-cluster", &eks.ClusterArgs{
Name: pulumi.String("my-cluster"),
})
assert.NoError(t, err)
sa := Blah{}
args := BlahArgs{
EksCluster: cluster.ToClusterOutput(),
Bar: pulumi.String("baz"),
}
_, err = sa.Construct(ctx, "my-sa", "xyx:abc:Blah", args, pulumi.Protect(false))
assert.NoError(t, err)
return nil
}, pulumi.WithMocks("project", "stack", mocks(0)))
if err != nil {
log.Fatal(err)
}
}