-
-
Notifications
You must be signed in to change notification settings - Fork 33
Component testing guide #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7d81f39
d975a71
69334a4
6bb0388
3b7136e
567865d
385c52d
2e59c98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename folder to |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| components: | ||
| terraform: | ||
| vpc: | ||
| metadata: | ||
| component: vpc | ||
| vars: | ||
| name: "vpc" | ||
| availability_zones: | ||
| - "b" | ||
| - "c" | ||
| public_subnets_enabled: true | ||
| max_nats: 1 | ||
| # Private subnets do not need internet access | ||
| nat_gateway_enabled: false | ||
| nat_instance_enabled: false | ||
| subnet_type_tag_key: "eg.cptest.co/subnet/type" | ||
| max_subnet_count: 3 | ||
| vpc_flow_logs_enabled: false | ||
| ipv4_primary_cidr_block: "172.16.0.0/16" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| helper "github.com/cloudposse/test-helpers/pkg/atmos/component-helper" | ||
| ) | ||
|
|
||
| type ComponentSuite struct { | ||
| helper.TestSuite | ||
| } | ||
|
|
||
| func TestRunSuite(t *testing.T) { | ||
| suite := new(ComponentSuite) | ||
|
|
||
| // Deploy the dependent vpc component | ||
| suite.AddDependency(t, "vpc", "default-test", nil) | ||
|
|
||
| helper.Run(t, suite) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import: | ||
| - orgs/default/test/_defaults | ||
| # Import the dependent component | ||
| - catalog/vpc |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| apiVersion: atmos/v1 | ||
| kind: AtmosVendorConfig | ||
| metadata: | ||
| name: fixtures | ||
| description: Atmos vendoring manifest | ||
| spec: | ||
| sources: | ||
| - component: "account-map" | ||
| source: github.com/cloudposse/terraform-aws-components.git//modules/account-map?ref={{.Version}} | ||
| version: 1.520.0 | ||
| targets: | ||
| - "components/terraform/account-map" | ||
| included_paths: | ||
| - "**/*.tf" | ||
| - "**/*.md" | ||
| - "**/*.tftmpl" | ||
| - "**/modules/**" | ||
| excluded_paths: [] | ||
|
|
||
| # Example of a dependency from vpc component | ||
| - component: "vpc" | ||
| source: github.com/cloudposse-terraform-components/aws-vpc.git//src?ref={{.Version}} | ||
| version: v1.536.0 | ||
| # Specify the path to the component directory | ||
| targets: | ||
| - "components/terraform/vpc" | ||
| included_paths: | ||
| - "**/*.tf" | ||
| - "**/*.md" | ||
| - "**/*.tftmpl" | ||
| - "**/modules/**" | ||
| excluded_paths: [] | ||
| # Example of a dependency from vpc component |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import: | ||
| - orgs/default/test/_defaults | ||
| - catalog/vpc | ||
| # Import the usecase | ||
| - catalog/usecase/basic |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| components: | ||
| terraform: | ||
| # You can replace example-component with your component name | ||
| example-component/basic: | ||
| metadata: | ||
| # Component name dir should be always `target` | ||
| component: target | ||
| vars: | ||
| enabled: true | ||
| # Add other inputs that are required for the use case |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import: | ||
| - orgs/default/test/_defaults | ||
| - catalog/vpc | ||
| - catalog/usecase/basic | ||
| # Import the "disabled" usecase | ||
| - catalog/usecase/disabled |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| components: | ||
| terraform: | ||
| # You can replace example-component with your component name | ||
| example-component/disabled: | ||
| metadata: | ||
| component: target | ||
| vars: | ||
| # Disable the component | ||
| enabled: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we deleting this?