Skip to content

Commit 01a1ba5

Browse files
committed
Adds match func to existing nap v4 tests
1 parent 9f8eacf commit 01a1ba5

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

analyze_test.go

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,9 @@ func TestAnalyze_nap_app_protect_enable(t *testing.T) {
560560
tc := tc
561561
t.Run(name, func(t *testing.T) {
562562
t.Parallel()
563-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
563+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
564+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
565+
})
564566

565567
if !tc.wantErr && err != nil {
566568
t.Fatal(err)
@@ -622,7 +624,9 @@ func TestAnalyze_nap_app_protect_security_log_enable(t *testing.T) {
622624
tc := tc
623625
t.Run(name, func(t *testing.T) {
624626
t.Parallel()
625-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
627+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
628+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
629+
})
626630

627631
if !tc.wantErr && err != nil {
628632
t.Fatal(err)
@@ -675,7 +679,9 @@ func TestAnalyze_nap_app_protect_security_log(t *testing.T) {
675679
tc := tc
676680
t.Run(name, func(t *testing.T) {
677681
t.Parallel()
678-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
682+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
683+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
684+
})
679685

680686
if !tc.wantErr && err != nil {
681687
t.Fatal(err)
@@ -728,7 +734,9 @@ func TestAnalyze_nap_app_protect_policy_file(t *testing.T) {
728734
tc := tc
729735
t.Run(name, func(t *testing.T) {
730736
t.Parallel()
731-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
737+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
738+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
739+
})
732740

733741
if !tc.wantErr && err != nil {
734742
t.Fatal(err)
@@ -790,7 +798,9 @@ func TestAnalyze_nap_app_protect_physical_memory_util_thresholds(t *testing.T) {
790798
tc := tc
791799
t.Run(name, func(t *testing.T) {
792800
t.Parallel()
793-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
801+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
802+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
803+
})
794804

795805
if !tc.wantErr && err != nil {
796806
t.Fatal(err)
@@ -852,7 +862,9 @@ func TestAnalyze_nap_app_protect_cpu_thresholds(t *testing.T) {
852862
tc := tc
853863
t.Run(name, func(t *testing.T) {
854864
t.Parallel()
855-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
865+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
866+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
867+
})
856868

857869
if !tc.wantErr && err != nil {
858870
t.Fatal(err)
@@ -914,7 +926,9 @@ func TestAnalyze_nap_app_protect_failure_mode_action(t *testing.T) {
914926
tc := tc
915927
t.Run(name, func(t *testing.T) {
916928
t.Parallel()
917-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
929+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
930+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
931+
})
918932

919933
if !tc.wantErr && err != nil {
920934
t.Fatal(err)
@@ -976,7 +990,9 @@ func TestAnalyze_nap_app_protect_cookie_seed(t *testing.T) {
976990
tc := tc
977991
t.Run(name, func(t *testing.T) {
978992
t.Parallel()
979-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
993+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
994+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
995+
})
980996

981997
if !tc.wantErr && err != nil {
982998
t.Fatal(err)
@@ -1038,7 +1054,9 @@ func TestAnalyze_nap_app_protect_compressed_requests_action(t *testing.T) {
10381054
tc := tc
10391055
t.Run(name, func(t *testing.T) {
10401056
t.Parallel()
1041-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
1057+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
1058+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
1059+
})
10421060

10431061
if !tc.wantErr && err != nil {
10441062
t.Fatal(err)
@@ -1100,7 +1118,9 @@ func TestAnalyze_nap_app_protect_request_buffer_overflow_action(t *testing.T) {
11001118
tc := tc
11011119
t.Run(name, func(t *testing.T) {
11021120
t.Parallel()
1103-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
1121+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
1122+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
1123+
})
11041124

11051125
if !tc.wantErr && err != nil {
11061126
t.Fatal(err)
@@ -1162,7 +1182,9 @@ func TestAnalyze_nap_app_protect_user_defined_signatures(t *testing.T) {
11621182
tc := tc
11631183
t.Run(name, func(t *testing.T) {
11641184
t.Parallel()
1165-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
1185+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
1186+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
1187+
})
11661188

11671189
if !tc.wantErr && err != nil {
11681190
t.Fatal(err)
@@ -1224,7 +1246,9 @@ func TestAnalyze_nap_app_protect_reconnect_period_seconds(t *testing.T) {
12241246
tc := tc
12251247
t.Run(name, func(t *testing.T) {
12261248
t.Parallel()
1227-
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{})
1249+
err := analyze("nginx.conf", tc.stmt, ";", tc.ctx, &ParseOptions{
1250+
MatchFuncs: []MatchFunc{MatchAppProtectWAFv4},
1251+
})
12281252

12291253
if !tc.wantErr && err != nil {
12301254
t.Fatal(err)

0 commit comments

Comments
 (0)