diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-09 10:20:59 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-09 11:39:18 +0200 |
commit | 5976bba0b5dd67d2169641a5c3dab935155fb885 (patch) | |
tree | c06237305a4e1280dfe7c9fe08c8bc15bb14ae63 /mailgun/resource_mailgun_domain_test.go | |
parent | dbbb014f494c502d8ac26437acd02412ee275b5a (diff) | |
download | terraform-provider-mailgun-5976bba0b5dd67d2169641a5c3dab935155fb885.tar.gz terraform-provider-mailgun-5976bba0b5dd67d2169641a5c3dab935155fb885.tar.zst terraform-provider-mailgun-5976bba0b5dd67d2169641a5c3dab935155fb885.zip |
fix the tests
the ips are now fetched correctly
a sleep was put in the destroy check to ensure that the api have time to destroy before it is checked
Diffstat (limited to 'mailgun/resource_mailgun_domain_test.go')
-rw-r--r-- | mailgun/resource_mailgun_domain_test.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mailgun/resource_mailgun_domain_test.go b/mailgun/resource_mailgun_domain_test.go index 952e013..a129b1f 100644 --- a/mailgun/resource_mailgun_domain_test.go +++ b/mailgun/resource_mailgun_domain_test.go | |||
@@ -21,7 +21,7 @@ type fullDomain struct { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | func getFullDomain(mg *mailgun.MailgunImpl, domainName string) (*fullDomain, error) { | 23 | func getFullDomain(mg *mailgun.MailgunImpl, domainName string) (*fullDomain, error) { |
24 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) | 24 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*120) |
25 | defer cancel() | 25 | defer cancel() |
26 | mg = mailgun.NewMailgun(domainName, mg.APIKey()) | 26 | mg = mailgun.NewMailgun(domainName, mg.APIKey()) |
27 | 27 | ||
@@ -42,7 +42,8 @@ func getFullDomain(mg *mailgun.MailgunImpl, domainName string) (*fullDomain, err | |||
42 | return nil, fmt.Errorf("Error Getting mailgun domain tracking Details for %s: Error: %s", domainName, err) | 42 | return nil, fmt.Errorf("Error Getting mailgun domain tracking Details for %s: Error: %s", domainName, err) |
43 | } | 43 | } |
44 | 44 | ||
45 | ipAddress, err := mg.ListDomainIPS(ctx) | 45 | ipAddress, err := getIps(ctx, mg) |
46 | |||
46 | if err != nil { | 47 | if err != nil { |
47 | return nil, fmt.Errorf("Error Getting mailgun domain ips2 for %s: Error: %s", domainName, err) | 48 | return nil, fmt.Errorf("Error Getting mailgun domain ips2 for %s: Error: %s", domainName, err) |
48 | } | 49 | } |
@@ -209,7 +210,7 @@ func testAccDomainCheckDestroy(domain *fullDomain) resource.TestCheckFunc { | |||
209 | mg := testAccProvider.Meta().(*mailgun.MailgunImpl) | 210 | mg := testAccProvider.Meta().(*mailgun.MailgunImpl) |
210 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) | 211 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) |
211 | defer cancel() | 212 | defer cancel() |
212 | 213 | time.Sleep(5 * time.Second) | |
213 | _, err := mg.GetDomain(ctx, domain.domainResponse.Domain.Name) | 214 | _, err := mg.GetDomain(ctx, domain.domainResponse.Domain.Name) |
214 | if err == nil { | 215 | if err == nil { |
215 | return fmt.Errorf("domain still exists") | 216 | return fmt.Errorf("domain still exists") |