From 9d2e4049471af8e82a8270439698b1a9caaba0f2 Mon Sep 17 00:00:00 2001 From: Sean McGrail Date: Thu, 20 Jan 2022 05:02:07 +0000 Subject: [PATCH] Remove WAF smoke test (#4247) --- private/model/api/smoke.go | 28 +++++++++++++++++++++++++++- service/waf/integ_test.go | 30 ------------------------------ service/wafregional/integ_test.go | 30 ------------------------------ 3 files changed, 27 insertions(+), 61 deletions(-) diff --git a/private/model/api/smoke.go b/private/model/api/smoke.go index 2aff8a26c9c..13607dcb04a 100644 --- a/private/model/api/smoke.go +++ b/private/model/api/smoke.go @@ -27,7 +27,33 @@ type SmokeTestCase struct { } var smokeTestsCustomizations = map[string]func(*SmokeTestSuite) error{ - "sts": stsSmokeTestCustomization, + "sts": stsSmokeTestCustomization, + "waf": wafSmokeTestCustomization, + "wafregional": wafRegionalSmokeTestCustomization, +} + +func wafSmokeTestCustomization(suite *SmokeTestSuite) error { + return filterWAFCreateSqlInjectionMatchSet(suite) +} + +func wafRegionalSmokeTestCustomization(suite *SmokeTestSuite) error { + return filterWAFCreateSqlInjectionMatchSet(suite) +} + +func filterWAFCreateSqlInjectionMatchSet(suite *SmokeTestSuite) error { + const createSqlInjectionMatchSetOp = "CreateSqlInjectionMatchSet" + + var testCases []SmokeTestCase + for _, testCase := range suite.TestCases { + if testCase.OpName == createSqlInjectionMatchSetOp { + continue + } + testCases = append(testCases, testCase) + } + + suite.TestCases = testCases + + return nil } func stsSmokeTestCustomization(suite *SmokeTestSuite) error { diff --git a/service/waf/integ_test.go b/service/waf/integ_test.go index 148bdbba38f..562369910cb 100644 --- a/service/waf/integ_test.go +++ b/service/waf/integ_test.go @@ -37,33 +37,3 @@ func TestInteg_00_ListRules(t *testing.T) { t.Errorf("expect no error, got %v", err) } } -func TestInteg_01_CreateSqlInjectionMatchSet(t *testing.T) { - ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) - defer cancelFn() - - sess := integration.SessionWithDefaultRegion("us-east-1") - svc := waf.New(sess) - params := &waf.CreateSqlInjectionMatchSetInput{ - ChangeToken: aws.String("fake_token"), - Name: aws.String("fake_name"), - } - _, err := svc.CreateSqlInjectionMatchSetWithContext(ctx, params, func(r *request.Request) { - r.Handlers.Validate.RemoveByName("core.ValidateParametersHandler") - }) - if err == nil { - t.Fatalf("expect request to fail") - } - aerr, ok := err.(awserr.RequestFailure) - if !ok { - t.Fatalf("expect awserr, was %T", err) - } - if len(aerr.Code()) == 0 { - t.Errorf("expect non-empty error code") - } - if len(aerr.Message()) == 0 { - t.Errorf("expect non-empty error message") - } - if v := aerr.Code(); v == request.ErrCodeSerialization { - t.Errorf("expect API error code got serialization failure") - } -} diff --git a/service/wafregional/integ_test.go b/service/wafregional/integ_test.go index 87f4aed7f64..21cdd4a907c 100644 --- a/service/wafregional/integ_test.go +++ b/service/wafregional/integ_test.go @@ -38,33 +38,3 @@ func TestInteg_00_ListRules(t *testing.T) { t.Errorf("expect no error, got %v", err) } } -func TestInteg_01_CreateSqlInjectionMatchSet(t *testing.T) { - ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) - defer cancelFn() - - sess := integration.SessionWithDefaultRegion("us-east-1") - svc := wafregional.New(sess) - params := &waf.CreateSqlInjectionMatchSetInput{ - ChangeToken: aws.String("fake_token"), - Name: aws.String("fake_name"), - } - _, err := svc.CreateSqlInjectionMatchSetWithContext(ctx, params, func(r *request.Request) { - r.Handlers.Validate.RemoveByName("core.ValidateParametersHandler") - }) - if err == nil { - t.Fatalf("expect request to fail") - } - aerr, ok := err.(awserr.RequestFailure) - if !ok { - t.Fatalf("expect awserr, was %T", err) - } - if len(aerr.Code()) == 0 { - t.Errorf("expect non-empty error code") - } - if len(aerr.Message()) == 0 { - t.Errorf("expect non-empty error message") - } - if v := aerr.Code(); v == request.ErrCodeSerialization { - t.Errorf("expect API error code got serialization failure") - } -}