provider_test.go 1.3 KB

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