Skip to content

AttachProviderBinary takes no effect #140

@t0yv0

Description

@t0yv0

What happened?

AttachProviderBinary takes no effect and ignores the intent.

Example

package main

import (
	pt "github.com/pulumi/providertest/pulumitest"
	"github.com/pulumi/providertest/pulumitest/opttest"
	"github.com/stretchr/testify/require"
	"os"
	"os/exec"
	"path/filepath"
	"testing"
)

func Test_Random(t *testing.T) {

	wd, err := os.Getwd()
	require.NoError(t, err)

	wda, err := filepath.Abs(wd)
	require.NoError(t, err)

	wd = wda

	cmd := exec.Command("make", "-B", "provider")
	cmd.Dir = filepath.Join(wd, "..", "pulumi-random")
	err = cmd.Run()
	require.NoError(t, err)

	randomProviderBin := filepath.Join(wd, "..", "pulumi-random", "bin")
	randomProvider := filepath.Join(wd, "..", "pulumi-random", "bin", "pulumi-resource-random")
	ptest := pt.NewPulumiTest(t,
		"test-proj",
		opttest.SkipInstall(),
		opttest.AttachProviderBinary("random", randomProvider),
		opttest.Env("PATH", os.Getenv("PATH")+string(os.PathListSeparator)+randomProviderBin),
	)

	upResult := ptest.Up(t)

	t.Logf("%s", upResult.StdOut)
	t.Logf("%s", upResult.StdErr)

}

I had to add the "PATH" override for this to use the binary I want. Without it Pulumi would install non-local random provider release.

anton@anton-mbp-m3> pulumi plugin ls                                                                                                                                                                   ~/code/refresh-by-default/tests
NAME    KIND      VERSION  SIZE   INSTALLED      LAST USED
random  resource  4.18.1   44 MB  6 seconds ago  6 seconds ago

Output of pulumi about

github.com/pulumi/providertest v0.3.1

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions