From 071f3b8fbf811d604a5010baf8a40c218ddca685 Mon Sep 17 00:00:00 2001 From: Ben Jee Date: Fri, 15 Aug 2025 13:58:22 -0700 Subject: [PATCH 1/5] Fix sf functional test --- .../manifests/snippets-filter/valid-sf.yaml | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/suite/manifests/snippets-filter/valid-sf.yaml b/tests/suite/manifests/snippets-filter/valid-sf.yaml index ca036a5d8f..2a8c7691ee 100644 --- a/tests/suite/manifests/snippets-filter/valid-sf.yaml +++ b/tests/suite/manifests/snippets-filter/valid-sf.yaml @@ -29,49 +29,49 @@ spec: value: tcp_nodelay on; --- apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute +kind: GRPCRoute metadata: - name: coffee + name: grpc-route spec: parentRefs: - name: gateway sectionName: http - hostnames: - - "cafe.example.com" rules: - matches: - - path: - type: PathPrefix - value: /coffee + - method: + service: helloworld.Greeter + method: SayHello filters: - type: ExtensionRef extensionRef: group: gateway.nginx.org kind: SnippetsFilter - name: all-contexts + name: grpc-all-contexts backendRefs: - - name: coffee - port: 80 + - name: grpc-backend + port: 8080 --- apiVersion: gateway.networking.k8s.io/v1 -kind: GRPCRoute +kind: HTTPRoute metadata: - name: grpc-route + name: coffee spec: parentRefs: - name: gateway sectionName: http + hostnames: + - "cafe.example.com" rules: - matches: - - method: - service: helloworld.Greeter - method: SayHello + - path: + type: PathPrefix + value: /coffee filters: - type: ExtensionRef extensionRef: group: gateway.nginx.org kind: SnippetsFilter - name: grpc-all-contexts + name: all-contexts backendRefs: - - name: grpc-backend - port: 8080 + - name: coffee + port: 80 From 09cb68ebc0dd09584bbeb37fdab4be0b7fa4d404 Mon Sep 17 00:00:00 2001 From: Ben Jee Date: Mon, 18 Aug 2025 16:27:36 -0700 Subject: [PATCH 2/5] Add wait for ready apps check --- .../manifests/snippets-filter/valid-sf.yaml | 36 +++++++++---------- tests/suite/snippets_filter_test.go | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/tests/suite/manifests/snippets-filter/valid-sf.yaml b/tests/suite/manifests/snippets-filter/valid-sf.yaml index 2a8c7691ee..ca036a5d8f 100644 --- a/tests/suite/manifests/snippets-filter/valid-sf.yaml +++ b/tests/suite/manifests/snippets-filter/valid-sf.yaml @@ -29,49 +29,49 @@ spec: value: tcp_nodelay on; --- apiVersion: gateway.networking.k8s.io/v1 -kind: GRPCRoute +kind: HTTPRoute metadata: - name: grpc-route + name: coffee spec: parentRefs: - name: gateway sectionName: http + hostnames: + - "cafe.example.com" rules: - matches: - - method: - service: helloworld.Greeter - method: SayHello + - path: + type: PathPrefix + value: /coffee filters: - type: ExtensionRef extensionRef: group: gateway.nginx.org kind: SnippetsFilter - name: grpc-all-contexts + name: all-contexts backendRefs: - - name: grpc-backend - port: 8080 + - name: coffee + port: 80 --- apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute +kind: GRPCRoute metadata: - name: coffee + name: grpc-route spec: parentRefs: - name: gateway sectionName: http - hostnames: - - "cafe.example.com" rules: - matches: - - path: - type: PathPrefix - value: /coffee + - method: + service: helloworld.Greeter + method: SayHello filters: - type: ExtensionRef extensionRef: group: gateway.nginx.org kind: SnippetsFilter - name: all-contexts + name: grpc-all-contexts backendRefs: - - name: coffee - port: 80 + - name: grpc-backend + port: 8080 diff --git a/tests/suite/snippets_filter_test.go b/tests/suite/snippets_filter_test.go index 8a45d2277b..bc0b276e64 100644 --- a/tests/suite/snippets_filter_test.go +++ b/tests/suite/snippets_filter_test.go @@ -64,6 +64,7 @@ var _ = Describe("SnippetsFilter", Ordered, Label("functional", "snippets-filter BeforeAll(func() { Expect(resourceManager.ApplyFromFiles(snippetsFilter, namespace)).To(Succeed()) + Expect(resourceManager.WaitForAppsToBeReady(namespace)).To(Succeed()) }) AfterAll(func() { From 69d1e3c7699523bb42c84046ee0f1a88943ef77e Mon Sep 17 00:00:00 2001 From: Ben Jee Date: Tue, 19 Aug 2025 10:31:43 -0700 Subject: [PATCH 3/5] Add flake attempts --- tests/suite/snippets_filter_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/suite/snippets_filter_test.go b/tests/suite/snippets_filter_test.go index bc0b276e64..fbd0cf4a2d 100644 --- a/tests/suite/snippets_filter_test.go +++ b/tests/suite/snippets_filter_test.go @@ -18,7 +18,7 @@ import ( "github.com/nginx/nginx-gateway-fabric/v2/tests/framework" ) -var _ = Describe("SnippetsFilter", Ordered, Label("functional", "snippets-filter"), func() { +var _ = Describe("SnippetsFilter", Ordered, FlakeAttempts(2), Label("functional", "snippets-filter"), func() { var ( files = []string{ "snippets-filter/cafe.yaml", From fdc661376cfbf416d2ce7b338ee47037ebc5e662 Mon Sep 17 00:00:00 2001 From: Ben Jee Date: Wed, 20 Aug 2025 11:49:24 -0700 Subject: [PATCH 4/5] Run pipeline with default nginx directives in snippets --- .../manifests/snippets-filter/valid-sf.yaml | 10 +++---- tests/suite/snippets_filter_test.go | 28 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/suite/manifests/snippets-filter/valid-sf.yaml b/tests/suite/manifests/snippets-filter/valid-sf.yaml index ca036a5d8f..851155c50d 100644 --- a/tests/suite/manifests/snippets-filter/valid-sf.yaml +++ b/tests/suite/manifests/snippets-filter/valid-sf.yaml @@ -7,11 +7,11 @@ spec: - context: main value: worker_priority 0; - context: http - value: aio on; + value: aio off; - context: http.server - value: auth_delay 10s; + value: auth_delay 0s; - context: http.server.location - value: keepalive_time 10s; + value: keepalive_time 1h; --- apiVersion: gateway.nginx.org/v1alpha1 kind: SnippetsFilter @@ -19,8 +19,8 @@ metadata: name: grpc-all-contexts spec: snippets: - - context: main - value: worker_shutdown_timeout 120s; + # - context: main + # value: worker_shutdown_timeout 120s; - context: http value: types_hash_bucket_size 64; - context: http.server diff --git a/tests/suite/snippets_filter_test.go b/tests/suite/snippets_filter_test.go index fbd0cf4a2d..5062a27277 100644 --- a/tests/suite/snippets_filter_test.go +++ b/tests/suite/snippets_filter_test.go @@ -18,7 +18,7 @@ import ( "github.com/nginx/nginx-gateway-fabric/v2/tests/framework" ) -var _ = Describe("SnippetsFilter", Ordered, FlakeAttempts(2), Label("functional", "snippets-filter"), func() { +var _ = Describe("SnippetsFilter", Ordered, Label("functional", "snippets-filter"), func() { var ( files = []string{ "snippets-filter/cafe.yaml", @@ -144,7 +144,7 @@ var _ = Describe("SnippetsFilter", Ordered, FlakeAttempts(2), Label("functional" }, { Directive: "aio", - Value: "on", + Value: "off", File: fmt.Sprintf("%s%s", httpContext, httpRouteSuffix), }, { @@ -154,7 +154,7 @@ var _ = Describe("SnippetsFilter", Ordered, FlakeAttempts(2), Label("functional" }, { Directive: "auth_delay", - Value: "10s", + Value: "0s", File: fmt.Sprintf("%s%s", httpServerContext, httpRouteSuffix), }, { @@ -172,21 +172,21 @@ var _ = Describe("SnippetsFilter", Ordered, FlakeAttempts(2), Label("functional" }, { Directive: "keepalive_time", - Value: "10s", + Value: "1h", File: fmt.Sprintf("%s%s", httpServerLocationContext, httpRouteSuffix), }, }), Entry("GRPCRoute", []framework.ExpectedNginxField{ - { - Directive: "worker_shutdown_timeout", - Value: "120s", - File: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), - }, - { - Directive: "include", - Value: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), - File: "main.conf", - }, + // { + // Directive: "worker_shutdown_timeout", + // Value: "120s", + // File: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), + // }, + // { + // Directive: "include", + // Value: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), + // File: "main.conf", + // }, { Directive: "types_hash_bucket_size", Value: "64", From bb32261930c0b7ec6709653fafed8290ac0c08da Mon Sep 17 00:00:00 2001 From: Ben Jee Date: Wed, 20 Aug 2025 14:18:48 -0700 Subject: [PATCH 5/5] Increase request timeout --- tests/framework/timeout.go | 2 +- .../manifests/snippets-filter/valid-sf.yaml | 4 ++-- tests/suite/snippets_filter_test.go | 20 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/framework/timeout.go b/tests/framework/timeout.go index 394f9e351d..72e51ef190 100644 --- a/tests/framework/timeout.go +++ b/tests/framework/timeout.go @@ -49,7 +49,7 @@ func DefaultTimeoutConfig() TimeoutConfig { DeleteNamespaceTimeout: 150 * time.Second, GetTimeout: 10 * time.Second, ManifestFetchTimeout: 10 * time.Second, - RequestTimeout: 10 * time.Second, + RequestTimeout: 30 * time.Second, ContainerRestartTimeout: 10 * time.Second, GetLeaderLeaseTimeout: 60 * time.Second, GetStatusTimeout: 60 * time.Second, diff --git a/tests/suite/manifests/snippets-filter/valid-sf.yaml b/tests/suite/manifests/snippets-filter/valid-sf.yaml index 851155c50d..91086daa67 100644 --- a/tests/suite/manifests/snippets-filter/valid-sf.yaml +++ b/tests/suite/manifests/snippets-filter/valid-sf.yaml @@ -19,8 +19,8 @@ metadata: name: grpc-all-contexts spec: snippets: - # - context: main - # value: worker_shutdown_timeout 120s; + - context: main + value: worker_shutdown_timeout 120s; - context: http value: types_hash_bucket_size 64; - context: http.server diff --git a/tests/suite/snippets_filter_test.go b/tests/suite/snippets_filter_test.go index 5062a27277..7c91c93565 100644 --- a/tests/suite/snippets_filter_test.go +++ b/tests/suite/snippets_filter_test.go @@ -177,16 +177,16 @@ var _ = Describe("SnippetsFilter", Ordered, Label("functional", "snippets-filter }, }), Entry("GRPCRoute", []framework.ExpectedNginxField{ - // { - // Directive: "worker_shutdown_timeout", - // Value: "120s", - // File: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), - // }, - // { - // Directive: "include", - // Value: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), - // File: "main.conf", - // }, + { + Directive: "worker_shutdown_timeout", + Value: "120s", + File: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), + }, + { + Directive: "include", + Value: fmt.Sprintf("%s%s", mainContext, grpcRouteSuffix), + File: "main.conf", + }, { Directive: "types_hash_bucket_size", Value: "64",