Skip to content

Commit

Permalink
XraySamplingRule aceptance tests now check values of resource attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dedoussis committed May 7, 2019
1 parent 75ba18a commit 7810470
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
38 changes: 28 additions & 10 deletions aws/resource_aws_xray_sampling_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ func TestAccAWSXraySamplingRule_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckXraySamplingRuleExists(resourceName, &samplingRule),
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "xray", fmt.Sprintf("sampling-rule/%s", ruleName)),
resource.TestCheckResourceAttrSet(resourceName, "priority"),
resource.TestCheckResourceAttrSet(resourceName, "version"),
resource.TestCheckResourceAttrSet(resourceName, "reservoir_size"),
resource.TestCheckResourceAttrSet(resourceName, "url_path"),
resource.TestCheckResourceAttrSet(resourceName, "host"),
resource.TestCheckResourceAttrSet(resourceName, "http_method"),
resource.TestCheckResourceAttrSet(resourceName, "fixed_rate"),
resource.TestCheckResourceAttrSet(resourceName, "resource_arn"),
resource.TestCheckResourceAttrSet(resourceName, "service_name"),
resource.TestCheckResourceAttrSet(resourceName, "service_type"),
resource.TestCheckResourceAttr(resourceName, "priority", "5"),
resource.TestCheckResourceAttr(resourceName, "version", "1"),
resource.TestCheckResourceAttr(resourceName, "reservoir_size", "10"),
resource.TestCheckResourceAttr(resourceName, "url_path", "*"),
resource.TestCheckResourceAttr(resourceName, "host", "*"),
resource.TestCheckResourceAttr(resourceName, "http_method", "GET"),
resource.TestCheckResourceAttr(resourceName, "fixed_rate", "0.3"),
resource.TestCheckResourceAttr(resourceName, "resource_arn", "*"),
resource.TestCheckResourceAttr(resourceName, "service_name", "*"),
resource.TestCheckResourceAttr(resourceName, "service_type", "*"),
resource.TestCheckResourceAttr(resourceName, "attributes.%", "1"),
),
},
Expand Down Expand Up @@ -66,6 +66,16 @@ func TestAccAWSXraySamplingRule_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckXraySamplingRuleExists(resourceName, &samplingRule),
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "xray", fmt.Sprintf("sampling-rule/%s", ruleName)),
resource.TestCheckResourceAttrSet(resourceName, "priority"),
resource.TestCheckResourceAttrSet(resourceName, "reservoir_size"),
resource.TestCheckResourceAttr(resourceName, "version", "1"),
resource.TestCheckResourceAttr(resourceName, "url_path", "*"),
resource.TestCheckResourceAttr(resourceName, "host", "*"),
resource.TestCheckResourceAttr(resourceName, "http_method", "GET"),
resource.TestCheckResourceAttr(resourceName, "fixed_rate", "0.3"),
resource.TestCheckResourceAttr(resourceName, "resource_arn", "*"),
resource.TestCheckResourceAttr(resourceName, "service_name", "*"),
resource.TestCheckResourceAttr(resourceName, "service_type", "*"),
resource.TestCheckResourceAttr(resourceName, "attributes.%", "0"),
),
},
Expand All @@ -76,6 +86,14 @@ func TestAccAWSXraySamplingRule_update(t *testing.T) {
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "xray", fmt.Sprintf("sampling-rule/%s", ruleName)),
resource.TestCheckResourceAttr(resourceName, "priority", fmt.Sprintf("%d", updatedPriority)),
resource.TestCheckResourceAttr(resourceName, "reservoir_size", fmt.Sprintf("%d", updatedReservoirSize)),
resource.TestCheckResourceAttr(resourceName, "version", "1"),
resource.TestCheckResourceAttr(resourceName, "url_path", "*"),
resource.TestCheckResourceAttr(resourceName, "host", "*"),
resource.TestCheckResourceAttr(resourceName, "http_method", "GET"),
resource.TestCheckResourceAttr(resourceName, "fixed_rate", "0.3"),
resource.TestCheckResourceAttr(resourceName, "resource_arn", "*"),
resource.TestCheckResourceAttr(resourceName, "service_name", "*"),
resource.TestCheckResourceAttr(resourceName, "service_type", "*"),
resource.TestCheckResourceAttr(resourceName, "attributes.%", "0"),
),
},
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/xray_sampling_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ resource "aws_xray_sampling_rule" "example" {

In addition to the arguments above, the following attributes are exported:

* `rule_arn` - The ARN of the sampling rule.
* `id` - The name of the sampling rule.
* `arn` - The ARN of the sampling rule.

## Import

Expand Down

0 comments on commit 7810470

Please sign in to comment.