mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-08 15:13:56 -06:00
8ae31740e3
* Replace DNSimple API client with the official Go client * Upgrade DNSimple provider to use the new API v2 Acceptance tests pass: ``` === RUN TestProvider --- PASS: TestProvider (0.00s) === RUN TestProvider_impl --- PASS: TestProvider_impl (0.00s) === RUN TestAccDNSimpleRecord_Basic --- PASS: TestAccDNSimpleRecord_Basic (2.67s) === RUN TestAccDNSimpleRecord_Updated --- PASS: TestAccDNSimpleRecord_Updated (1.88s) PASS ok github.com/hashicorp/terraform/builtin/providers/dnsimple ``` Note that the code still has to be updated to pass the account ID dynamically in place of "TODO-ACCOUNT". * Refactor DNSimple provider to expose both client and config The config is required as the new API wants to know the identifier of the account you are operating to. The account is not stored in the client (as the client can talk with different accounts), hence I need to pass it as part of the config. * Identify Terraform requests to DNSimple via UserAgent * Upgrade to the latest dnsimple-go version * Update docs Provide upgrade instructions and update the docs for API v2. * Remove rendundant type declaration
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package dnsimple
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
var testAccProviders map[string]terraform.ResourceProvider
|
|
var testAccProvider *schema.Provider
|
|
|
|
func init() {
|
|
testAccProvider = Provider().(*schema.Provider)
|
|
testAccProviders = map[string]terraform.ResourceProvider{
|
|
"dnsimple": testAccProvider,
|
|
}
|
|
}
|
|
|
|
func TestProvider(t *testing.T) {
|
|
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
}
|
|
|
|
func TestProvider_impl(t *testing.T) {
|
|
var _ terraform.ResourceProvider = Provider()
|
|
}
|
|
|
|
func testAccPreCheck(t *testing.T) {
|
|
if v := os.Getenv("DNSIMPLE_EMAIL"); v != "" {
|
|
t.Fatal("DNSIMPLE_EMAIL is no longer required for DNSimple API v2")
|
|
}
|
|
|
|
if v := os.Getenv("DNSIMPLE_TOKEN"); v == "" {
|
|
t.Fatal("DNSIMPLE_TOKEN must be set for acceptance tests")
|
|
}
|
|
|
|
if v := os.Getenv("DNSIMPLE_ACCOUNT"); v == "" {
|
|
t.Fatal("DNSIMPLE_ACCOUNT must be set for acceptance tests")
|
|
}
|
|
|
|
if v := os.Getenv("DNSIMPLE_DOMAIN"); v == "" {
|
|
t.Fatal("DNSIMPLE_DOMAIN must be set for acceptance tests. The domain is used to create and destroy record against.")
|
|
}
|
|
}
|