Skip to content

Commit 55ae9cb

Browse files
committed
Added tests
1 parent b2bc67b commit 55ae9cb

File tree

10 files changed

+331
-276
lines changed

10 files changed

+331
-276
lines changed

test/component_test.go

Lines changed: 160 additions & 209 deletions
Large diffs are not rendered by default.

test/fixtures/stacks/catalog/usecase/basic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ components:
22
terraform:
33
aurora-postgres/basic:
44
metadata:
5-
component: aurora-postgres
5+
component: target
66
vars:
77
enabled: true
88
name: db
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
components:
2+
terraform:
3+
aurora-postgres/disabled:
4+
metadata:
5+
component: target
6+
vars:
7+
enabled: false
8+
name: db
9+
tags:
10+
Team: sre
11+
Service: aurora-postgres
12+
cluster_name: basic
13+
deletion_protection: false
14+
storage_encrypted: true
15+
engine: aurora-postgresql
16+
publicly_accessible: true
17+
18+
dns_gbl_delegated_environment_name: "ue2"
19+
20+
# Provisioned configuration
21+
engine_mode: provisioned
22+
engine_version: "15.3"
23+
cluster_family: aurora-postgresql15
24+
# 1 writer, 1 reader
25+
cluster_size: 2
26+
# https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html
27+
instance_type: db.t3.medium
28+
29+
admin_user: postgres
30+
admin_password: "" # generate random password
31+
database_name: postgres
32+
database_port: 5432
33+
skip_final_snapshot: true
34+
# Enhanced Monitoring
35+
# A boolean flag to enable/disable the creation of the enhanced monitoring IAM role.
36+
# If set to false, the module will not create a new role and will use rds_monitoring_role_arn for enhanced monitoring
37+
enhanced_monitoring_role_enabled: true
38+
# The interval, in seconds, between points when enhanced monitoring metrics are collected for the DB instance.
39+
# To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60
40+
rds_monitoring_interval: 15
41+
# Allow ingress from the following accounts
42+
# If any of tenant, stage, or environment aren't given, this will be taken
43+
allow_ingress_from_vpc_accounts: []
44+
# - tenant: core
45+
# stage: auto

test/fixtures/stacks/catalog/usecase/serverless.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ components:
22
terraform:
33
aurora-postgres/serverless:
44
metadata:
5-
component: aurora-postgres
5+
component: target
66
vars:
77
enabled: true
88
name: db

test/fixtures/stacks/orgs/default/test/_defaults.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ terraform:
55
backend_type: local
66
backend:
77
local:
8-
path: '{{ getenv "TEST_STATE_DIR" | default "../../../../../state" }}/{{ getenv "TEST_SUITE_NAME" | default "" }}/{{ .component }}/terraform.tfstate'
9-
workspace_dir: '{{ getenv "TEST_STATE_DIR" | default "../../../../../state" }}/{{ getenv "TEST_SUITE_NAME" | default "" }}/{{ .component }}/'
10-
remote_state_backend_type: local
11-
remote_state_backend:
12-
local:
13-
path: '{{ getenv "TEST_STATE_DIR" | default "../../../../../state" }}/{{ getenv "TEST_SUITE_NAME" | default "" }}/{{ .component }}/terraform.tfstate'
14-
workspace_dir: '{{ getenv "TEST_STATE_DIR" | default "../../../../../state" }}/{{ getenv "TEST_SUITE_NAME" | default "" }}/{{ .component }}/'
8+
path: '{{ getenv "COMPONENT_HELPER_STATE_DIR" | default "../../../state" }}/{{ .component }}/terraform.tfstate'
9+
workspace_dir: '{{ getenv "COMPONENT_HELPER_STATE_DIR" | default "../../../state" }}/{{ .component }}/'
1510
vars:
1611
namespace: eg
1712
tenant: default

test/fixtures/stacks/orgs/default/test/tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ import:
55
- catalog/vpc
66
- catalog/usecase/basic
77
- catalog/usecase/serverless
8+
- catalog/usecase/disabled

test/fixtures/vendor.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,3 @@ spec:
5252
- "**/*.tftmpl"
5353
- "**/modules/**"
5454
excluded_paths: []
55-
56-
- component: "aurora-postgres"
57-
source: "../../src"
58-
targets:
59-
- "components/terraform/aurora-postgres"
60-
included_paths:
61-
- "**/*.tf"
62-
- "**/*.md"
63-
- "**/*.tftmpl"
64-
- "**/modules/**"
65-
excluded_paths: []

test/go.mod

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module test
33
go 1.23.0
44

55
require (
6-
github.com/cloudposse/test-helpers v0.12.1-0.20250109031059-3e4cb91c4f88
6+
github.com/cloudposse/test-helpers v0.15.1-0.20250207205949-73491a56240b
77
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
88
github.com/gruntwork-io/terratest v0.48.1
99
github.com/mattn/go-zglob v0.0.3 // indirect
@@ -55,19 +55,25 @@ require (
5555
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 // indirect
5656
github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 // indirect
5757
github.com/aws/smithy-go v1.22.1 // indirect
58+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
5859
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
59-
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
60+
github.com/boombuler/barcode v1.0.1 // indirect
61+
github.com/charmbracelet/lipgloss v0.10.0 // indirect
62+
github.com/charmbracelet/log v0.4.0 // indirect
6063
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
61-
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
64+
github.com/fsnotify/fsnotify v1.7.0 // indirect
65+
github.com/go-errors/errors v1.4.2 // indirect
66+
github.com/go-logfmt/logfmt v0.6.0 // indirect
6267
github.com/go-sql-driver/mysql v1.8.1 // indirect
6368
github.com/google/uuid v1.6.0 // indirect
64-
github.com/gruntwork-io/go-commons v0.8.0 // indirect
69+
github.com/gruntwork-io/go-commons v0.13.3 // indirect
6570
github.com/hashicorp/errwrap v1.1.0 // indirect
6671
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
6772
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect
6873
github.com/hashicorp/go-multierror v1.1.1 // indirect
6974
github.com/hashicorp/go-safetemp v1.0.0 // indirect
7075
github.com/hashicorp/go-version v1.7.0 // indirect
76+
github.com/hashicorp/hcl v1.0.0 // indirect
7177
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
7278
github.com/hashicorp/terraform-json v0.23.0 // indirect
7379
github.com/jackc/pgpassfile v1.0.0 // indirect
@@ -76,22 +82,43 @@ require (
7682
github.com/jackc/puddle/v2 v2.2.2 // indirect
7783
github.com/jinzhu/copier v0.4.0 // indirect
7884
github.com/jmespath/go-jmespath v0.4.0 // indirect
79-
github.com/klauspost/compress v1.17.0 // indirect
80-
github.com/kr/text v0.1.0 // indirect
85+
github.com/klauspost/compress v1.17.2 // indirect
86+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
87+
github.com/magiconair/properties v1.8.7 // indirect
88+
github.com/mattn/go-isatty v0.0.20 // indirect
89+
github.com/mattn/go-runewidth v0.0.15 // indirect
8190
github.com/mitchellh/go-homedir v1.1.0 // indirect
8291
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
8392
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
93+
github.com/mitchellh/mapstructure v1.5.0 // indirect
94+
github.com/muesli/reflow v0.3.0 // indirect
95+
github.com/muesli/termenv v0.15.2 // indirect
96+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
8497
github.com/pquerna/otp v1.4.0 // indirect
98+
github.com/rivo/uniseg v0.4.7 // indirect
8599
github.com/russross/blackfriday/v2 v2.1.0 // indirect
100+
github.com/sagikazarmark/locafero v0.4.0 // indirect
101+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
102+
github.com/sourcegraph/conc v0.3.0 // indirect
103+
github.com/spf13/afero v1.11.0 // indirect
104+
github.com/spf13/cast v1.6.0 // indirect
105+
github.com/spf13/pflag v1.0.5 // indirect
106+
github.com/spf13/viper v1.19.0 // indirect
107+
github.com/subosito/gotenv v1.6.0 // indirect
86108
github.com/tmccombs/hcl2json v0.6.4 // indirect
87109
github.com/ulikunitz/xz v0.5.11 // indirect
88-
github.com/urfave/cli v1.22.16 // indirect
110+
github.com/urfave/cli/v2 v2.20.2 // indirect
111+
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
89112
github.com/zclconf/go-cty v1.15.0 // indirect
113+
go.uber.org/atomic v1.9.0 // indirect
114+
go.uber.org/multierr v1.9.0 // indirect
90115
golang.org/x/crypto v0.32.0 // indirect
116+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
91117
golang.org/x/mod v0.18.0 // indirect
92118
golang.org/x/net v0.34.0 // indirect
93119
golang.org/x/sync v0.10.0 // indirect
94120
golang.org/x/sys v0.29.0 // indirect
95121
golang.org/x/text v0.21.0 // indirect
96122
golang.org/x/tools v0.22.0 // indirect
123+
gopkg.in/ini.v1 v1.67.0 // indirect
97124
)

0 commit comments

Comments
 (0)