Skip to content
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

tests/guardduty: Add ErrorCheck #18221

Merged
merged 10 commits into from
Mar 19, 2021
7 changes: 5 additions & 2 deletions aws/data_source_aws_guardduty_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package aws
import (
"testing"

"github.com/aws/aws-sdk-go/service/guardduty"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func testAccAWSGuarddutyDetectorDataSource_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
PreventPostDestroyRefresh: true,
Steps: []resource.TestStep{
Expand All @@ -31,8 +33,9 @@ func testAccAWSGuarddutyDetectorDataSource_basic(t *testing.T) {

func testAccAWSGuarddutyDetectorDataSource_Id(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccAwsGuarddutyDetectorExplicitConfig(),
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_guardduty_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func testAccAwsGuardDutyDetector_basic(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyDetectorDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -121,6 +122,7 @@ func testAccAwsGuardDutyDetector_tags(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyDetectorDestroy,
Steps: []resource.TestStep{
Expand Down
4 changes: 4 additions & 0 deletions aws/resource_aws_guardduty_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func testAccAwsGuardDutyFilter_basic(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyFilterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -86,6 +87,7 @@ func testAccAwsGuardDutyFilter_update(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyFilterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -129,6 +131,7 @@ func testAccAwsGuardDutyFilter_tags(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyFilterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -169,6 +172,7 @@ func testAccAwsGuardDutyFilter_disappears(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy,
Steps: []resource.TestStep{
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_guardduty_invite_accepter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func testAccAwsGuardDutyInviteAccepter_basic(t *testing.T) {
testAccPreCheck(t)
testAccAlternateAccountPreCheck(t)
},
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAwsGuardDutyInviteAccepterDestroy,
Steps: []resource.TestStep{
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_guardduty_ipset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func testAccAwsGuardDutyIpset_basic(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyIpsetDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -60,6 +61,7 @@ func testAccAwsGuardDutyIpset_tags(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyIpsetDestroy,
Steps: []resource.TestStep{
Expand Down
4 changes: 4 additions & 0 deletions aws/resource_aws_guardduty_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func testAccAwsGuardDutyMember_basic(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -45,6 +46,7 @@ func testAccAwsGuardDutyMember_invite_disassociate(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -83,6 +85,7 @@ func testAccAwsGuardDutyMember_invite_onUpdate(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -122,6 +125,7 @@ func testAccAwsGuardDutyMember_invitationMessage(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy,
Steps: []resource.TestStep{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func testAccAwsGuardDutyOrganizationAdminAccount_basic(t *testing.T) {
testAccPreCheck(t)
testAccOrganizationsAccountPreCheck(t)
},
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyOrganizationAdminAccountDestroy,
Steps: []resource.TestStep{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/aws/aws-sdk-go/service/guardduty"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

Expand All @@ -16,7 +17,8 @@ func testAccAwsGuardDutyOrganizationConfiguration_basic(t *testing.T) {
testAccPreCheck(t)
testAccOrganizationsAccountPreCheck(t)
},
Providers: testAccProviders,
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
// GuardDuty Organization Configuration cannot be deleted separately.
// Ensure parent resource is destroyed instead.
CheckDestroy: testAccCheckAwsGuardDutyDetectorDestroy,
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_guardduty_publishing_destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func testAccAwsGuardDutyPublishingDestination_basic(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyPublishingDestinationDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -114,6 +115,7 @@ func testAccAwsGuardDutyPublishingDestination_disappears(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyPublishingDestinationDestroy,
Steps: []resource.TestStep{
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_guardduty_threatintelset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func testAccAwsGuardDutyThreatintelset_basic(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyThreatintelsetDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -60,6 +61,7 @@ func testAccAwsGuardDutyThreatintelset_tags(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsGuardDutyThreatintelsetDestroy,
Steps: []resource.TestStep{
Expand Down