Skip to content

Commit

Permalink
refactor: moved test to pr_test
Browse files Browse the repository at this point in the history
  • Loading branch information
imprateeksh committed Feb 18, 2025
1 parent 921b887 commit ada5563
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
30 changes: 0 additions & 30 deletions tests/other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ import (
"github.com/stretchr/testify/assert"
)

// To verify DNS records creation
var dnsRecordsMap = []map[string]interface{}{
{"name": "testA", "type": "A", "rdata": "1.2.3.4", "ttl": 3600},
{"name": "testAAAA", "type": "AAAA", "rdata": "2001:0db8:0012:0001:3c5e:7354:0000:5db5"},
{"name": "testCNAME", "type": "CNAME", "rdata": "test.com"},
{"name": "testTXT", "type": "TXT", "rdata": "textinformation", "ttl": 900},
{"name": "testMX", "type": "MX", "rdata": "mailserver.test.com", "preference": 10},
{"name": "testSRV", "type": "SRV", "rdata": "tester.com", "priority": 100, "weight": 100, "port": 8000, "service": "_sip", "protocol": "udp"},
}

func TestRunBasicExample(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -64,23 +54,3 @@ func TestRunSpecificZoneExample(t *testing.T) {
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}

func TestRunVpcWithDnsExample(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefaultWithVars(&testhelper.TestOptions{
Testing: t,
TerraformDir: vpcWithDnsExampleTerraformDir,
Prefix: "dns-slz",
ResourceGroup: resourceGroup,
Region: "us-south",
})
options.TerraformVars = map[string]interface{}{
"dns_records": dnsRecordsMap,
"name": "test-dns",
"dns_zone_name": "slz.com",
}
output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}
30 changes: 30 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-res

var permanentResources map[string]interface{}

// To verify DNS records creation
var dnsRecordsMap = []map[string]interface{}{
{"name": "testA", "type": "A", "rdata": "1.2.3.4", "ttl": 3600},
{"name": "testAAAA", "type": "AAAA", "rdata": "2001:0db8:0012:0001:3c5e:7354:0000:5db5"},
{"name": "testCNAME", "type": "CNAME", "rdata": "test.com"},
{"name": "testTXT", "type": "TXT", "rdata": "textinformation", "ttl": 900},
{"name": "testMX", "type": "MX", "rdata": "mailserver.test.com", "preference": 10},
{"name": "testSRV", "type": "SRV", "rdata": "tester.com", "priority": 100, "weight": 100, "port": 8000, "service": "_sip", "protocol": "udp"},
}

func TestMain(m *testing.M) {
// Read the YAML file contents
var err error
Expand Down Expand Up @@ -172,3 +182,23 @@ func TestRunExistingVPCExample(t *testing.T) {
logger.Log(t, "END: Destroy (existing resources)")
}
}

func TestRunVpcWithDnsExample(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefaultWithVars(&testhelper.TestOptions{
Testing: t,
TerraformDir: vpcWithDnsExampleTerraformDir,
Prefix: "dns-slz",
ResourceGroup: resourceGroup,
Region: "us-south",
})
options.TerraformVars = map[string]interface{}{
"dns_records": dnsRecordsMap,
"name": "test-dns",
"dns_zone_name": "slz.com",
}
output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}

0 comments on commit ada5563

Please sign in to comment.