Closed Tensho closed 2 years ago
@weppos Please could you check this PR?
@weppos Please could you check this PR?
/cc @ecomba
@weppos Please could you check this PR?
/cc @ecomba
Thank you @weppos !
@Tensho I've added this to my todo
and will check it (this week).
Thank you so much for the effort! ❤️
@ecomba Thanks. Keep waiting for your review 🙇
@ecomba Nudge reminder 😉
Hey @Tensho I am looking into this at the moment.
I am not able to run the whole acceptance test suite though as your tests fail when I do so.
Can you try running the tests with DNSIMPLE_ACCOUNT=your_account_id DNSIMPLE_TOKEN="your_token" DNSIMPLE_DOMAIN=a_domain DNSIMPLE_SANDBOX=true make testacc
?
@ecomba Would you mind to walk me through the development setup at DNSimple side please? I've already created account in a sandbox environment and tried to run test suite against it. But it feels like tests depend on some pre-existing data there or ordered run. For example, TestAccDNSimpleZoneRead
tests zone data source behavior but doesn't create the one before 🤷♂️
$ env | grep DNSIMPLE
DNSIMPLE_ACCOUNT=1697
DNSIMPLE_TOKEN=<REDACTED>
DNSIMPLE_DOMAIN=terraform-provider-dnsimple.dev
DNSIMPLE_SANDBOX=true
$ make testacc TEST=./dnsimple
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./dnsimple -v -timeout 120m
=== RUN TestAccDNSimpleZoneRead
--- FAIL: TestAccDNSimpleZoneRead (1.46s)
testing_new_config.go:81: no "id" found in attributes
testing_new.go:53: no "id" found in attributes
=== RUN TestAccDnsimpleDomain_import
--- PASS: TestAccDnsimpleDomain_import (2.87s)
=== RUN TestAccDnsimpleEmailForward_import
--- FAIL: TestAccDnsimpleEmailForward_import (0.82s)
import_dnsimple_email_forward_test.go:16: Step 1/2 error: Error running apply: exit status 1
2021/10/22 12:42:13 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple EmailForward: POST https://api.sandbox.dnsimple.com/v2/1697/domains/terraform-provider-dnsimple.dev/email_forwards: 404 Domain `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_email_forward" "wildcard":
2: resource "dnsimple_email_forward" "wildcard" {
=== RUN TestAccDnsimpleRecord_import
--- FAIL: TestAccDnsimpleRecord_import (0.81s)
import_dnsimple_zone_record_test.go:15: Step 1/2 error: Error running apply: exit status 1
2021/10/22 12:42:14 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
2: resource "dnsimple_zone_record" "foobar" {
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_sandbox
--- PASS: TestProvider_sandbox (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAccDNSimpleDomainCreate
--- PASS: TestAccDNSimpleDomainCreate (2.50s)
=== RUN TestAccCheckDNSimpleEmailForwardConfig_Basic
--- FAIL: TestAccCheckDNSimpleEmailForwardConfig_Basic (0.83s)
resource_dnsimple_email_forward_test.go:19: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:17 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple EmailForward: POST https://api.sandbox.dnsimple.com/v2/1697/domains/terraform-provider-dnsimple.dev/email_forwards: 404 Domain `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_email_forward" "hello":
2: resource "dnsimple_email_forward" "hello" {
=== RUN TestAccDNSimpleRecord_Basic
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- FAIL: TestAccDNSimpleRecord_Basic (0.81s)
resource_dnsimple_record_test.go:19: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:18 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_record" "foobar":
2: resource "dnsimple_record" "foobar" {
=== RUN TestAccDNSimpleRecord_BasicOldConf
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- FAIL: TestAccDNSimpleRecord_BasicOldConf (0.87s)
resource_dnsimple_record_test.go:45: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:19 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_record" "foobar":
2: resource "dnsimple_record" "foobar" {
=== RUN TestAccDNSimpleRecord_CreateMxWithPriority
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- FAIL: TestAccDNSimpleRecord_CreateMxWithPriority (0.89s)
resource_dnsimple_record_test.go:71: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:20 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_record" "foobar":
2: resource "dnsimple_record" "foobar" {
=== RUN TestAccDNSimpleRecord_Updated
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- FAIL: TestAccDNSimpleRecord_Updated (0.94s)
resource_dnsimple_record_test.go:98: Step 1/2 error: Error running apply: exit status 1
2021/10/22 12:42:21 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_record" "foobar":
2: resource "dnsimple_record" "foobar" {
=== RUN TestAccDNSimpleRecord_disappears
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- FAIL: TestAccDNSimpleRecord_disappears (0.94s)
resource_dnsimple_record_test.go:137: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:22 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_record" "foobar":
2: resource "dnsimple_record" "foobar" {
=== RUN TestAccDNSimpleRecord_UpdatedMx
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- FAIL: TestAccDNSimpleRecord_UpdatedMx (0.92s)
resource_dnsimple_record_test.go:158: Step 1/2 error: Error running apply: exit status 1
2021/10/22 12:42:23 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_record" "foobar":
2: resource "dnsimple_record" "foobar" {
=== RUN TestAccDNSimpleZoneRecord_Basic
--- FAIL: TestAccDNSimpleZoneRecord_Basic (0.83s)
resource_dnsimple_zone_record_test.go:20: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:24 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
2: resource "dnsimple_zone_record" "foobar" {
=== RUN TestAccDNSimpleZoneRecord_CreateMxWithPriority
--- FAIL: TestAccDNSimpleZoneRecord_CreateMxWithPriority (0.92s)
resource_dnsimple_zone_record_test.go:46: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:24 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
2: resource "dnsimple_zone_record" "foobar" {
=== RUN TestAccDNSimpleZoneRecord_Updated
--- FAIL: TestAccDNSimpleZoneRecord_Updated (1.01s)
resource_dnsimple_zone_record_test.go:73: Step 1/2 error: Error running apply: exit status 1
2021/10/22 12:42:25 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
2: resource "dnsimple_zone_record" "foobar" {
=== RUN TestAccDNSimpleZoneRecord_disappears
--- FAIL: TestAccDNSimpleZoneRecord_disappears (0.88s)
resource_dnsimple_zone_record_test.go:112: Step 1/1 error: Error running apply: exit status 1
2021/10/22 12:42:26 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
2: resource "dnsimple_zone_record" "foobar" {
=== RUN TestAccDNSimpleZoneRecord_UpdatedMx
--- FAIL: TestAccDNSimpleZoneRecord_UpdatedMx (0.84s)
resource_dnsimple_zone_record_test.go:133: Step 1/2 error: Error running apply: exit status 1
2021/10/22 12:42:27 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
Error: Failed to create DNSimple Record: POST https://api.sandbox.dnsimple.com/v2/1697/zones/terraform-provider-dnsimple.dev/records: 404 Zone `terraform-provider-dnsimple.dev` not found
on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
2: resource "dnsimple_zone_record" "foobar" {
=== RUN TestResourceExampleInstanceStateUpgradeV0
--- PASS: TestResourceExampleInstanceStateUpgradeV0 (0.00s)
FAIL
FAIL github.com/terraform-providers/terraform-provider-dnsimple/dnsimple 19.404s
FAIL
make: *** [testacc] Error 1
@ecomba Would you mind to walk me through the development setup at DNSimple side please? I've already created account in a sandbox environment and tried to run test suite against it. But it feels like tests depend on some pre-existing data there or ordered run. For example,
TestAccDNSimpleZoneRead
tests zone data source behavior but doesn't create the one before 🤷♂️$ env | grep DNSIMPLE DNSIMPLE_ACCOUNT=1697 DNSIMPLE_TOKEN=<REDACTED> DNSIMPLE_DOMAIN=terraform-provider-dnsimple.dev DNSIMPLE_SANDBOX=true $ make testacc TEST=./dnsimple
That's interesting. My setup is very basic. The only thing I make sure is to have the DNSIMPLE_DOMAIN
I will be using already in my sandbox environment (through the admin panel).
As for how I run the tests I don't use the TEST=./dnsimple
argument; just make testacc
.
Not sure if this helps (and before you say it, I agree, having to create the domain by hand before is not ideal; I have to change that).
@ecomba Fixed. All tests pass now within the sandbox environment:
$ env | grep DNSIMPLE
DNSIMPLE_ACCOUNT=1697
DNSIMPLE_TOKEN=<REDACTED>
DNSIMPLE_DOMAIN=terraform-provider-dnsimple.xyz
DNSIMPLE_SANDBOX=true
$ make testacc TEST=./dnsimple
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./dnsimple -v -timeout 120m
=== RUN TestAccDNSimpleZoneRead
--- PASS: TestAccDNSimpleZoneRead (2.82s)
=== RUN TestAccDnsimpleDomain_import
--- PASS: TestAccDnsimpleDomain_import (2.96s)
=== RUN TestAccDnsimpleEmailForward_import
--- PASS: TestAccDnsimpleEmailForward_import (3.70s)
=== RUN TestAccDnsimpleRecord_import
--- PASS: TestAccDnsimpleRecord_import (3.09s)
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_sandbox
--- PASS: TestProvider_sandbox (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAccDNSimpleDomainCreate
--- PASS: TestAccDNSimpleDomainCreate (2.69s)
=== RUN TestAccCheckDNSimpleEmailForwardConfig_Basic
--- PASS: TestAccCheckDNSimpleEmailForwardConfig_Basic (2.68s)
=== RUN TestAccDNSimpleRecord_Basic
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- PASS: TestAccDNSimpleRecord_Basic (2.57s)
=== RUN TestAccDNSimpleRecord_BasicOldConf
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- PASS: TestAccDNSimpleRecord_BasicOldConf (2.59s)
=== RUN TestAccDNSimpleRecord_CreateMxWithPriority
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- PASS: TestAccDNSimpleRecord_CreateMxWithPriority (2.65s)
=== RUN TestAccDNSimpleRecord_Updated
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- PASS: TestAccDNSimpleRecord_Updated (4.58s)
=== RUN TestAccDNSimpleRecord_disappears
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- PASS: TestAccDNSimpleRecord_disappears (2.30s)
=== RUN TestAccDNSimpleRecord_UpdatedMx
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
WARNING! This resource (dnsimple_record) is deprecated and will be removed in future versions
Please consider changing your configuration to use dnsimple_zone_record instead
--- PASS: TestAccDNSimpleRecord_UpdatedMx (4.59s)
=== RUN TestAccDNSimpleZoneRecord_Basic
[DEBUG] domain: terraform-provider-dnsimple.xyz
--- PASS: TestAccDNSimpleZoneRecord_Basic (2.59s)
=== RUN TestAccDNSimpleZoneRecord_CreateMxWithPriority
--- PASS: TestAccDNSimpleZoneRecord_CreateMxWithPriority (2.63s)
=== RUN TestAccDNSimpleZoneRecord_Updated
--- PASS: TestAccDNSimpleZoneRecord_Updated (4.95s)
=== RUN TestAccDNSimpleZoneRecord_disappears
--- PASS: TestAccDNSimpleZoneRecord_disappears (2.26s)
=== RUN TestAccDNSimpleZoneRecord_UpdatedMx
--- PASS: TestAccDNSimpleZoneRecord_UpdatedMx (4.59s)
=== RUN TestResourceExampleInstanceStateUpgradeV0
--- PASS: TestResourceExampleInstanceStateUpgradeV0 (0.00s)
PASS
ok github.com/terraform-providers/terraform-provider-dnsimple/dnsimple 54.491s
Thank you @Tensho !
I'll look at it today and merge it if everything goes according to plan!
dnsimple_domain
resource lacks the ability to import already exiting (manually added) domain. This PR extends resource with import by domain ID option. I'm not 100% sure domain ID is globally or in the scope of a particular account, so service maintainers' feedback would be appreciated.Test