You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
497 B
Go
27 lines
497 B
Go
package acctest
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/plugin"
|
|
tftest "github.com/hashicorp/terraform-plugin-test"
|
|
)
|
|
|
|
var TestHelper *tftest.Helper
|
|
|
|
func UseBinaryDriver(name string, providerFunc plugin.ProviderFunc) {
|
|
sourceDir, err := os.Getwd()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if tftest.RunningAsPlugin() {
|
|
plugin.Serve(&plugin.ServeOpts{
|
|
ProviderFunc: providerFunc,
|
|
})
|
|
os.Exit(0)
|
|
} else {
|
|
TestHelper = tftest.AutoInitProviderHelper(name, sourceDir)
|
|
}
|
|
}
|