Skip to content

Commit 00b9c11

Browse files
Updated Test
1 parent bc38702 commit 00b9c11

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

tests/dns-only/main.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ variable "region" {
88
type = string
99
}
1010

11+
variable "instance_name" {
12+
description = "The name of the instance"
13+
type = string
14+
}
15+
1116
module "red-instance" {
1217
source = "../../red-instance"
1318

14-
project_name = var.project_name
15-
region = var.region
19+
project_name = var.project_name
20+
region = var.region
21+
instance_name = var.instance_name
1622

1723
# Custom AMI and instance configuration
1824
ami_name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64-server-20250305"

tests/full-force/main.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ variable "region" {
88
type = string
99
}
1010

11+
variable "instance_name" {
12+
description = "The name of the instance"
13+
type = string
14+
}
15+
1116
module "red-instance" {
1217
source = "../../red-instance"
1318

14-
project_name = var.project_name
15-
region = var.region
19+
project_name = var.project_name
20+
region = var.region
21+
instance_name = var.instance_name
1622

1723
# Custom AMI and instance configuration
1824
ami_name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64-server-20250305"

tests/red_instance_test.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ func TestDNSOnlyFeature(t *testing.T) {
2424

2525
// Generate a unique project name for the test
2626
projectName := fmt.Sprintf("red-dns-%s", strings.ToLower(random.UniqueId()))
27+
instanceName := fmt.Sprintf("red-%s", strings.ToLower(random.UniqueId()))
2728

2829
terraformOptions := &terraform.Options{
2930
TerraformDir: "./dns-only",
3031
Vars: map[string]interface{}{
31-
"region": awsRegion,
32-
"project_name": projectName,
32+
"region": awsRegion,
33+
"project_name": projectName,
34+
"instance_name": instanceName,
3335
},
3436
}
3537

@@ -78,12 +80,14 @@ func TestAllFeaturesEnabled(t *testing.T) {
7880

7981
// Generate a unique project name and S3 bucket name for the test
8082
projectName := fmt.Sprintf("red-full-%s", strings.ToLower(random.UniqueId()))
83+
instanceName := fmt.Sprintf("red-%s", strings.ToLower(random.UniqueId()))
8184

8285
terraformOptions := &terraform.Options{
8386
TerraformDir: "./full-force",
8487
Vars: map[string]interface{}{
85-
"region": awsRegion,
86-
"project_name": projectName,
88+
"region": awsRegion,
89+
"project_name": projectName,
90+
"instance_name": instanceName,
8791
},
8892
}
8993

@@ -128,7 +132,6 @@ func TestAllFeaturesEnabled(t *testing.T) {
128132
func TestFeatureCombinations(t *testing.T) {
129133
testDirs := []string{
130134
"dns-only",
131-
"s3-access",
132135
"full-force",
133136
}
134137

@@ -146,6 +149,7 @@ func TestFeatureCombinations(t *testing.T) {
146149

147150
// Generate a unique project name for the test
148151
projectName := fmt.Sprintf("red-%s-%s", testDir, strings.ToLower(random.UniqueId()))
152+
instanceName := fmt.Sprintf("red-%s", strings.ToLower(random.UniqueId()))
149153

150154
// Make sure the test directory exists
151155
testDirPath := filepath.Join(".", testDir)
@@ -157,8 +161,9 @@ func TestFeatureCombinations(t *testing.T) {
157161
terraformOptions := &terraform.Options{
158162
TerraformDir: testDirPath,
159163
Vars: map[string]interface{}{
160-
"region": awsRegion,
161-
"project_name": projectName,
164+
"region": awsRegion,
165+
"project_name": projectName,
166+
"instance_name": instanceName,
162167
},
163168
}
164169

0 commit comments

Comments
 (0)