Skip to content

Commit

Permalink
fmt + sweeper changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 committed Aug 21, 2020
1 parent 46a747e commit e350c06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aws/resource_aws_backup_vault_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func resourceAwsBackupVaultNotificationsRead(d *schema.ResourceData, meta interf
d.Set("sns_topic_arn", resp.SNSTopicArn)
d.Set("backup_vault_arn", resp.BackupVaultArn)
if err := d.Set("backup_vault_events", flattenStringSet(resp.BackupVaultEvents)); err != nil {
return fmt.Errorf("error setting backup_vault_events: %w", err)
return fmt.Errorf("error setting backup_vault_events: %w", err)
}

return nil
Expand Down
12 changes: 9 additions & 3 deletions aws/resource_aws_backup_vault_notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"fmt"
"github.com/hashicorp/go-multierror"
"log"
"testing"

Expand All @@ -25,6 +26,7 @@ func testSweepBackupVaultNotifications(region string) error {
return fmt.Errorf("Error getting client: %w", err)
}
conn := client.(*AWSClient).backupconn
var sweeperErrs *multierror.Error

input := &backup.ListBackupVaultsInput{}

Expand All @@ -35,7 +37,8 @@ func testSweepBackupVaultNotifications(region string) error {
log.Printf("[WARN] Skipping Backup Vault Notifications sweep for %s: %s", region, err)
return nil
}
return fmt.Errorf("Error retrieving Backup Vault Notifications: %w", err)
sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error retrieving Backup Vault Notifications: %w", err))
return sweeperErrs.ErrorOrNil()
}

if len(output.BackupVaultList) == 0 {
Expand All @@ -51,7 +54,10 @@ func testSweepBackupVaultNotifications(region string) error {
BackupVaultName: aws.String(name),
})
if err != nil {
return fmt.Errorf("Error deleting Backup Vault Notifications %s: %w", name, err)
sweeperErr := fmt.Errorf("error deleting Backup Vault Notifications %s: %w", name, err)
log.Printf("[ERROR] %s", sweeperErr)
sweeperErrs = multierror.Append(sweeperErrs, sweeperErr)
continue
}
}

Expand All @@ -61,7 +67,7 @@ func testSweepBackupVaultNotifications(region string) error {
input.NextToken = output.NextToken
}

return nil
return sweeperErrs.ErrorOrNil()
}

func TestAccAwsBackupVaultNotification_basic(t *testing.T) {
Expand Down

0 comments on commit e350c06

Please sign in to comment.