I have a Pulumi Go program using the Automation AP...
# golang
b
I have a Pulumi Go program using the Automation API. Output streams to stdout as expected when calling the
Up()
function, but when I call it in a test with
go test
, the output isn't streamed to stdout. I'd like to be able to see live output streams as the tests run. My assumption was that the
optup.ProgressStreams(os.Stdout)
would handle this, but there must be some sort of extra wiring to get this to work. Any ideas?
Copy code
// Up provisions AWS infrastructure
func Up(region, instanceType string) error {
	pulumiStack, ctx := configurePulumi(region, instanceType)

	// Wire up our update to stream progress to stdout
	stdoutStreamer := optup.ProgressStreams(os.Stdout)

	// Run the update to deploy our infrastructure
	if _, err := pulumiStack.Up(ctx, stdoutStreamer); err != nil {
		return err
	}

	// Wait for ec2 instance to be ready
	if err := WaitInstanceReady(region); err != nil {
		return err
	}

	// Install k3s on ec2 instance
	if err := InstallK3s(region); err != nil {
		return err
	}

	// Copy kubeconfig from remote host to local machine
	if err := GetKubeconfig(region); err != nil {
		return err
	}

	return nil
}