Skip to content

Commit

Permalink
enha: added unit tests for the domain split (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
kfc-manager committed Mar 26, 2024
1 parent f5f43dd commit 94db03e
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/dns.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
provider "aws" {
region = "eu-central-1"
default_tags {
tags = {
Environment = "Test"
}
}
}

run "base_domain_split_without_sub_domain" {
command = plan

variables {
identifier = "abc"
domain = "test.com"
zone_id = "test-zone"
}

assert {
condition = local.base_domain == "test.com"
error_message = "Base domain split failed, wanted: 'test.com', got: ${local.base_domain}"
}
}

run "base_domain_split_with_single_sub_domain" {
command = plan

variables {
identifier = "abc"
domain = "www.test.com"
zone_id = "test-zone"
}

assert {
condition = local.base_domain == "test.com"
error_message = "Base domain split failed, wanted: 'test.com', got: ${local.base_domain}"
}
}

run "base_domain_split_with_multiple_sub_domain" {
command = plan

variables {
identifier = "abc"
domain = "www.blog.api.test.com"
zone_id = "test-zone"
}

assert {
condition = local.base_domain == "test.com"
error_message = "Base domain split failed, wanted: 'test.com', got: ${local.base_domain}"
}
}

0 comments on commit 94db03e

Please sign in to comment.