Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing test for email attribute #70

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions hostingde/record_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[email protected]"),
// 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"),
Expand All @@ -45,12 +47,12 @@ resource "hostingde_zone" "test" {
type = "NATIVE"
email = "[email protected]"
}
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
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -60,20 +62,12 @@ resource "hostingde_record" "test_mx2" {
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 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"),
resource.TestCheckResourceAttr("hostingde_zone.test", "email", "hostmaster@example2.test"),
// Verify dynamic values have any value set in the state.
resource.TestCheckResourceAttrSet("hostingde_record.test_mx2", "id"),
resource.TestCheckResourceAttrSet("hostingde_record.test_mx", "id"),
),
},
// Create and read TXT testing
Expand All @@ -97,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"),
Expand Down Expand Up @@ -148,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"),
),
},
Expand Down