Thread
#golang
    f

    fancy-spoon-7206

    3 months ago
    I am getting the below error after adding a simple integration test from the docs:
    func TestVpc(t *testing.T) {
    	awsRegion := "us-east-1"
    	cwd, _ := os.Getwd()
    
    	integration.ProgramTest(t, &integration.ProgramTestOptions{
    		Quick:       true,
    		SkipRefresh: true,
    		Dir:         path.Join(cwd, "..", "..", "aep-base-infra"),
    		Config: map[string]string{
    			"aws:region": awsRegion,
    		},
    	})
    }
    Error:
    ➜ resources (main) ✗ go test ./...
    panic: proto: duplicate enum registered: pulumirpc.EnforcementLevel
    
    goroutine 1 [running]:
    <http://github.com/golang/protobuf/proto.RegisterEnum({0x101cb7b88|github.com/golang/protobuf/proto.RegisterEnum({0x101cb7b88>, 0x1a}, 0x14000359a10?, 0x140003599e0?)
    	/Users/dinesh.auti/go/pkg/mod/github.com/golang/protobuf@v1.4.3/proto/registry.go:104 +0xb8
    <http://github.com/pulumi/pulumi/sdk/v2/proto/go.init.0()|github.com/pulumi/pulumi/sdk/v2/proto/go.init.0()>
    	/Users/dinesh.auti/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.25.2/proto/go/analyzer.pb.go:963 +0x44
    exit status 2
    FAIL	<http://github.com/aetion/aep-base-infra/internal/resources|github.com/aetion/aep-base-infra/internal/resources>	0.393s
    Has anyone seen this before? I am using Pulumi version 3.35.1
    Upgrading the version to v3 solved the issue.
    go get <http://github.com/pulumi/pulumi/pkg/v3/testing/integration|github.com/pulumi/pulumi/pkg/v3/testing/integration>
    l

    limited-rainbow-51650

    2 months ago
    Tip: always make sure that the Pulumi packages come from the same version, otherwise you have the chance that the code tries to register the protobufs spec more than once. I bumped into a similar issue myself earlier this week and learned a thing or two about the protobuf lib in go: https://github.com/pact-foundation/pact-plugins/issues/4