-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[testing] data source acc test (#340)
Add an acceptance test for our 1 data source. ## Test Plan * [ ] acceptance tests
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
pkg/datasources/system_get_aws_sns_iam_policy_acceptance_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package datasources_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/chanzuckerberg/terraform-provider-snowflake/pkg/provider" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
// FIXME refactor to testhelpers | ||
func providers() map[string]*schema.Provider { | ||
p := provider.Provider() | ||
return map[string]*schema.Provider{ | ||
"snowflake": p, | ||
} | ||
} | ||
|
||
func TestAccSystemGetAWSSNSIAMPolicy_basic(t *testing.T) { | ||
// r := require.New(t) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
Providers: providers(), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: policyConfig(), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("data.snowflake_system_get_aws_sns_iam_policy.p", "aws_sns_topic_arn", "arn:aws:sns:us-east-1:1234567890123456:mytopic"), | ||
resource.TestCheckResourceAttr("data.snowflake_system_get_aws_sns_iam_policy.p", "aws_sns_topic_policy_json", | ||
`{"Version":"2012-10-17","Statement":[{"Sid":"1","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::494544507972:user/3gmi-s-ssca3411"},"Action":["sns:Subscribe"],"Resource":["arn:aws:sns:us-east-1:1234567890123456:mytopic"]}]}`), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func policyConfig() string { | ||
s := ` | ||
data snowflake_system_get_aws_sns_iam_policy p { | ||
aws_sns_topic_arn = "arn:aws:sns:us-east-1:1234567890123456:mytopic" | ||
} | ||
` | ||
return s | ||
} |