Skip to content

Commit

Permalink
r/aws_pinpoint_app: Fix acceptance tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kit Ewbank authored and ewbankkit committed Jan 8, 2020
1 parent b1142a8 commit 1194412
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 125 deletions.
19 changes: 16 additions & 3 deletions aws/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,23 @@ func testAccEC2VPCOnlyPreCheck(t *testing.T) {
}
}

func testAccHasServicePreCheck(service string, t *testing.T) {
func testAccPartitionHasServicePreCheck(serviceId string, t *testing.T) {
if partition, ok := endpoints.PartitionForRegion(endpoints.DefaultPartitions(), testAccGetRegion()); ok {
if _, ok := partition.Services()[service]; !ok {
t.Skip(fmt.Sprintf("skipping tests; partition does not support %s service", service))
if _, ok := partition.Services()[serviceId]; !ok {
t.Skip(fmt.Sprintf("skipping tests; partition %s does not support %s service", partition.ID(), serviceId))
}
}
}

func testAccRegionHasServicePreCheck(serviceId string, t *testing.T) {
regionId := testAccGetRegion()
if partition, ok := endpoints.PartitionForRegion(endpoints.DefaultPartitions(), regionId); ok {
service, ok := partition.Services()[serviceId]
if !ok {
t.Skip(fmt.Sprintf("skipping tests; partition %s does not support %s service", partition.ID(), serviceId))
}
if _, ok := service.Regions()[regionId]; !ok {
t.Skip(fmt.Sprintf("skipping tests; region %s does not support %s service", regionId, serviceId))
}
}
}
Expand Down
20 changes: 12 additions & 8 deletions aws/resource_aws_pinpoint_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,24 @@ func resourceAwsPinpointApp() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"daily": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 100),
},
"maximum_duration": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntAtLeast(60),
},
"messages_per_second": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(50, 20000),
},
"total": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 100),
},
},
},
Expand Down
Loading

0 comments on commit 1194412

Please sign in to comment.