From 25da28ec5088075df81ba2a35fa212ef0efc751c Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:43:13 +0200 Subject: [PATCH 1/3] Revert "test: remove extraneous resource from test" This reverts commit 0424cb94ce40a80a47395782d9743bc888f67846. --- hostingde/record_resource_test.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/hostingde/record_resource_test.go b/hostingde/record_resource_test.go index fc3c7c8..07e08b0 100644 --- a/hostingde/record_resource_test.go +++ b/hostingde/record_resource_test.go @@ -45,12 +45,19 @@ resource "hostingde_zone" "test" { type = "NATIVE" email = "hostmaster@example2.test" } -resource "hostingde_record" "test_mx2" { +resource "hostingde_record" "test_mx" { zone_id = hostingde_zone.test.id name = "example2.test" type = "MX" - content = "mail2.example2.test" - priority = 20 + content = "mail.example2.test" + priority = 10 +} +resource "hostingde_record" "test_mx" { + zone_id = hostingde_zone.test.id + name = "example2.test" + type = "MX" + content = "mail.example2.test" + priority = 10 } `, Check: resource.ComposeAggregateTestCheckFunc( @@ -64,16 +71,6 @@ resource "hostingde_record" "test_mx2" { resource.TestCheckResourceAttr("hostingde_record.test_mx", "content", "mail.example2.test"), // Verify dynamic values have any value set in the state. resource.TestCheckResourceAttrSet("hostingde_record.test_mx", "id"), - // Verify name attribute. - resource.TestCheckResourceAttr("hostingde_record.test_mx2", "name", "example2.test"), - // Verify type attribute. - resource.TestCheckResourceAttr("hostingde_record.test_mx2", "type", "MX"), - // Verify priority attribute. - resource.TestCheckResourceAttr("hostingde_record.test_mx2", "priority", "20"), - // Verify email attribute. - resource.TestCheckResourceAttr("hostingde_record.test_mx2", "content", "mail2.example2.test"), - // Verify dynamic values have any value set in the state. - resource.TestCheckResourceAttrSet("hostingde_record.test_mx2", "id"), ), }, // Create and read TXT testing From aa0696850f701bc0275c32ed8d77d94bb508c837 Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:50:43 +0200 Subject: [PATCH 2/3] test: add missing test for email attribute --- hostingde/record_resource_test.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/hostingde/record_resource_test.go b/hostingde/record_resource_test.go index 07e08b0..917cd95 100644 --- a/hostingde/record_resource_test.go +++ b/hostingde/record_resource_test.go @@ -31,6 +31,8 @@ resource "hostingde_record" "test" { // Verify type attribute. resource.TestCheckResourceAttr("hostingde_record.test", "type", "CNAME"), // Verify email attribute. + resource.TestCheckResourceAttr("hostingde_zone.test", "email", "hostmaster@example2.test"), + // Verify content attribute. resource.TestCheckResourceAttr("hostingde_record.test", "content", "www.example.com"), // Verify dynamic values have any value set in the state. resource.TestCheckResourceAttrSet("hostingde_record.test", "id"), @@ -52,13 +54,6 @@ resource "hostingde_record" "test_mx" { content = "mail.example2.test" priority = 10 } -resource "hostingde_record" "test_mx" { - zone_id = hostingde_zone.test.id - name = "example2.test" - type = "MX" - content = "mail.example2.test" - priority = 10 -} `, Check: resource.ComposeAggregateTestCheckFunc( // Verify name attribute. @@ -67,8 +62,10 @@ resource "hostingde_record" "test_mx" { resource.TestCheckResourceAttr("hostingde_record.test_mx", "type", "MX"), // Verify priority attribute. resource.TestCheckResourceAttr("hostingde_record.test_mx", "priority", "10"), - // Verify email attribute. + // Verify content attribute. resource.TestCheckResourceAttr("hostingde_record.test_mx", "content", "mail.example2.test"), + // Verify email attribute. + resource.TestCheckResourceAttr("hostingde_zone.test", "email", "hostmaster@example2.test"), // Verify dynamic values have any value set in the state. resource.TestCheckResourceAttrSet("hostingde_record.test_mx", "id"), ), @@ -94,7 +91,7 @@ resource "hostingde_record" "test_dkim" { resource.TestCheckResourceAttr("hostingde_record.test_dkim", "name", "default._domainkey.example2.test"), // Verify type attribute. resource.TestCheckResourceAttr("hostingde_record.test_dkim", "type", "TXT"), - // Verify email attribute. + // Verify content attribute. resource.TestCheckResourceAttr("hostingde_record.test_dkim", "content", "v=DKIM1;k=rsa;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyla9hW3TvoXvZQxwzaJ4SZ9ict1HU3E6+FwLWniGe6TiPtcYrjTIsiudQb8tltibOXiS+qqbxzI+quI3aGU6osy2rIv0eWo8+oOOqOD9pERftc/aqe51cXuv4kPqwvpXEBwrXFWVM+VxivEubUJ7eKkFyXJpelv0LslXv/MmYbUyed6dF+reOGZCsvnbiRv74qdxbAL/25j62E8WrnxzJwhUtx/JhdBOjsHBvuw9hy6rZsVJL9eXayWyGRV6qmsLRzsRSBs+mDrgmKk4dugADd11+A03ics3i8hplRoWDkqnNKz1qy4f5TsV6v9283IANrAzRfHwX8EvNiFsBz+ZCQIDAQAB"), // Verify dynamic values have any value set in the state. resource.TestCheckResourceAttrSet("hostingde_record.test_dkim", "id"), From ab3fddd31f529d64828d4eef19677f1a32b8bc21 Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:57:36 +0200 Subject: [PATCH 3/3] test: fix comment --- hostingde/record_resource_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hostingde/record_resource_test.go b/hostingde/record_resource_test.go index 917cd95..b32e271 100644 --- a/hostingde/record_resource_test.go +++ b/hostingde/record_resource_test.go @@ -142,7 +142,7 @@ resource "hostingde_record" "test_mx" { Check: resource.ComposeAggregateTestCheckFunc( // Verify content attribute. resource.TestCheckResourceAttr("hostingde_record.test_mx", "content", "mail2.example2.test"), - // Verify content attribute. + // Verify priority attribute. resource.TestCheckResourceAttr("hostingde_record.test_mx", "priority", "20"), ), },