provider_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package provider
  2. import (
  3. "testing"
  4. "github.com/hashicorp/terraform-plugin-framework/providerserver"
  5. "github.com/hashicorp/terraform-plugin-go/tfprotov6"
  6. )
  7. const (
  8. // providerConfig is a shared configuration to combine with the actual
  9. // test configuration so the HashiCups client is properly configured.
  10. // It is also possible to use the HASHICUPS_ environment variables instead,
  11. // such as updating the Makefile and running the testing through that tool.
  12. //
  13. // language=terraform
  14. providerConfig = `
  15. provider "hashicups" {
  16. username = "education"
  17. password = "test123"
  18. host = "http://localhost:19090"
  19. }
  20. `
  21. )
  22. // testAccProtoV6ProviderFactories are used to instantiate a provider during
  23. // acceptance testing. The factory function will be invoked for every Terraform
  24. // CLI command executed to create a provider server to which the CLI can
  25. // reattach.
  26. var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
  27. "hashicups": providerserver.NewProtocol6WithError(New("test")()),
  28. }
  29. func testAccPreCheck(t *testing.T) {
  30. // You can add code here to run prior to any test case execution, for example assertions
  31. // about the appropriate environment variables being set are common to see in a pre-check
  32. // function.
  33. return
  34. }