remove old test provider from e2e tests
This commit is contained in:
parent
eee581ae54
commit
e4c72015a3
|
@ -33,7 +33,7 @@ func TestProviderDevOverrides(t *testing.T) {
|
||||||
// such as if it stops being buildable into an independent executable.
|
// such as if it stops being buildable into an independent executable.
|
||||||
providerExeDir := filepath.Join(tf.WorkDir(), "pkgdir")
|
providerExeDir := filepath.Join(tf.WorkDir(), "pkgdir")
|
||||||
providerExePrefix := filepath.Join(providerExeDir, "terraform-provider-test_")
|
providerExePrefix := filepath.Join(providerExeDir, "terraform-provider-test_")
|
||||||
providerExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/legacy/builtin/bins/provider-test", providerExePrefix)
|
providerExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple/main", providerExePrefix)
|
||||||
t.Logf("temporary provider executable is %s", providerExe)
|
t.Logf("temporary provider executable is %s", providerExe)
|
||||||
|
|
||||||
err := ioutil.WriteFile(filepath.Join(tf.WorkDir(), "dev.tfrc"), []byte(fmt.Sprintf(`
|
err := ioutil.WriteFile(filepath.Join(tf.WorkDir(), "dev.tfrc"), []byte(fmt.Sprintf(`
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_providers {
|
required_providers {
|
||||||
test = {
|
simple = {
|
||||||
source = "example.com/test/test"
|
source = "example.com/test/test"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "test" {
|
data "simple_resource" "test" {
|
||||||
}
|
|
||||||
|
|
||||||
data "test_data_source" "test" {
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
provider "test" {
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
simple = {
|
||||||
|
source = "hashicorp/test"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "test_resource_signal" "test" {
|
resource "simple_resource" "test" {
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
"github.com/hashicorp/go-hclog"
|
"github.com/hashicorp/go-hclog"
|
||||||
"github.com/hashicorp/go-plugin"
|
"github.com/hashicorp/go-plugin"
|
||||||
"github.com/hashicorp/terraform/e2e"
|
"github.com/hashicorp/terraform/e2e"
|
||||||
"github.com/hashicorp/terraform/internal/legacy/builtin/providers/test"
|
"github.com/hashicorp/terraform/internal/grpcwrap"
|
||||||
grpcplugin "github.com/hashicorp/terraform/internal/legacy/helper/plugin"
|
simple "github.com/hashicorp/terraform/internal/provider-simple"
|
||||||
proto "github.com/hashicorp/terraform/internal/tfplugin5"
|
proto "github.com/hashicorp/terraform/internal/tfplugin5"
|
||||||
tfplugin "github.com/hashicorp/terraform/plugin"
|
tfplugin "github.com/hashicorp/terraform/plugin"
|
||||||
)
|
)
|
||||||
|
@ -42,7 +42,7 @@ type reattachConfigAddr struct {
|
||||||
|
|
||||||
type providerServer struct {
|
type providerServer struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
*grpcplugin.GRPCProviderServer
|
proto.ProviderServer
|
||||||
planResourceChangeCalled bool
|
planResourceChangeCalled bool
|
||||||
applyResourceChangeCalled bool
|
applyResourceChangeCalled bool
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func (p *providerServer) PlanResourceChange(ctx context.Context, req *proto.Plan
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
p.planResourceChangeCalled = true
|
p.planResourceChangeCalled = true
|
||||||
return p.GRPCProviderServer.PlanResourceChange(ctx, req)
|
return p.ProviderServer.PlanResourceChange(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *providerServer) ApplyResourceChange(ctx context.Context, req *proto.ApplyResourceChange_Request) (*proto.ApplyResourceChange_Response, error) {
|
func (p *providerServer) ApplyResourceChange(ctx context.Context, req *proto.ApplyResourceChange_Request) (*proto.ApplyResourceChange_Response, error) {
|
||||||
|
@ -60,7 +60,7 @@ func (p *providerServer) ApplyResourceChange(ctx context.Context, req *proto.App
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
p.applyResourceChangeCalled = true
|
p.applyResourceChangeCalled = true
|
||||||
return p.GRPCProviderServer.ApplyResourceChange(ctx, req)
|
return p.ProviderServer.ApplyResourceChange(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *providerServer) PlanResourceChangeCalled() bool {
|
func (p *providerServer) PlanResourceChangeCalled() bool {
|
||||||
|
@ -99,7 +99,7 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||||
reattachCh := make(chan *plugin.ReattachConfig)
|
reattachCh := make(chan *plugin.ReattachConfig)
|
||||||
closeCh := make(chan struct{})
|
closeCh := make(chan struct{})
|
||||||
provider := &providerServer{
|
provider := &providerServer{
|
||||||
GRPCProviderServer: grpcplugin.NewGRPCProviderServerShim(test.Provider()),
|
ProviderServer: grpcwrap.New(simple.Provider()),
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -140,6 +140,7 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
tf.AddEnv("TF_REATTACH_PROVIDERS=" + string(reattachStr))
|
tf.AddEnv("TF_REATTACH_PROVIDERS=" + string(reattachStr))
|
||||||
tf.AddEnv("PLUGIN_PROTOCOL_VERSION=5")
|
tf.AddEnv("PLUGIN_PROTOCOL_VERSION=5")
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !provider.PlanResourceChangeCalled() {
|
if !provider.PlanResourceChangeCalled() {
|
||||||
t.Error("PlanResourceChange not called on in-process provider")
|
t.Error("PlanResourceChange not called on un-managed provider")
|
||||||
}
|
}
|
||||||
|
|
||||||
//// APPLY
|
//// APPLY
|
||||||
|
@ -174,7 +175,7 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !provider.ApplyResourceChangeCalled() {
|
if !provider.ApplyResourceChangeCalled() {
|
||||||
t.Error("ApplyResourceChange not called on in-process provider")
|
t.Error("ApplyResourceChange not called on un-managed provider")
|
||||||
}
|
}
|
||||||
provider.ResetApplyResourceChangeCalled()
|
provider.ResetApplyResourceChangeCalled()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue