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

Fix/increase nginx timeout #777

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions conformance/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
NKG_TAG = edge
NKG_PREFIX = nginx-kubernetes-gateway
GATEWAY_CLASS = nginx
SUPPORTED_FEATURES = Gateway,HTTPRoute
SUPPORTED_FEATURES = HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect
kate-osborn marked this conversation as resolved.
Show resolved Hide resolved
EXEMPT_FEATURES = ReferenceGrant
KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind
TAG = latest
PREFIX = conformance-test-runner
Expand Down Expand Up @@ -44,7 +45,7 @@ update-test-kind-config: ## Update kind config
.PHONY: run-conformance-tests
run-conformance-tests: update-test-kind-config ## Run conformance tests
docker run --network=kind --rm -v $(KIND_KUBE_CONFIG_FOLDER):/root/.kube $(PREFIX):$(TAG) \
go test -v . -tags conformance -args --gateway-class=$(GATEWAY_CLASS) --supported-features=$(SUPPORTED_FEATURES)
go test -timeout 25m -v . -tags conformance -args --gateway-class=$(GATEWAY_CLASS) --debug --supported-features=$(SUPPORTED_FEATURES) --exempt-features=$(EXEMPT_FEATURES)

.PHONY: uninstall-nkg
uninstall-nkg: ## Uninstall NKG on configured kind cluster
Expand Down
24 changes: 23 additions & 1 deletion conformance/tests/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ limitations under the License.
package tests

import (
"strings"
"testing"

. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/gateway-api/apis/v1alpha2"
Expand All @@ -41,6 +43,9 @@ func TestConformance(t *testing.T) {
g.Expect(v1alpha2.AddToScheme(client.Scheme())).To(Succeed())
g.Expect(v1beta1.AddToScheme(client.Scheme())).To(Succeed())

supportedFeatures := parseSupportedFeatures(*flags.SupportedFeatures)
exemptFeatures := parseSupportedFeatures(*flags.ExemptFeatures)

t.Logf(`Running conformance tests with %s GatewayClass\n cleanup: %t\n`+
`debug: %t\n enable all features: %t \n supported features: [%v]\n exempt features: [%v]`,
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug,
Expand All @@ -51,9 +56,26 @@ func TestConformance(t *testing.T) {
GatewayClassName: *flags.GatewayClassName,
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
SupportedFeatures: nil,
SupportedFeatures: supportedFeatures,
ExemptFeatures: exemptFeatures,
EnableAllSupportedFeatures: *flags.EnableAllSupportedFeatures,
})
cSuite.Setup(t)
cSuite.Run(t, tests.ConformanceTests)
}

// parseSupportedFeatures parses flag arguments and converts the string to
// sets.Set[suite.SupportedFeature]
// FIXME(kate-osborn): Use exported ParseSupportedFeatures function
// https://github.com/kubernetes-sigs/gateway-api/blob/63e423cf1b837991d2747742199d90863a98b0c3/conformance/utils/suite/suite.go#L235
// once it's released. https://github.com/nginxinc/nginx-kubernetes-gateway/issues/779
func parseSupportedFeatures(f string) sets.Set[suite.SupportedFeature] {
if f == "" {
return nil
}
res := sets.Set[suite.SupportedFeature]{}
for _, value := range strings.Split(f, ",") {
res.Insert(suite.SupportedFeature(value))
}
return res
}
4 changes: 2 additions & 2 deletions internal/nginx/runtime/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

const (
pidFile = "/etc/nginx/nginx.pid"
pidFileTimeout = 5 * time.Second
pidFileTimeout = 10 * time.Second
)

type (
Expand Down Expand Up @@ -81,7 +81,7 @@ func findMainProcess(

err := wait.PollUntilContextCancel(
ctx,
1*time.Second,
500*time.Millisecond,
true, /* poll immediately */
func(ctx context.Context) (bool, error) {
_, err := checkFile(pidFile)
Expand Down