Skip to content

Commit

Permalink
update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthyparty committed Aug 7, 2024
1 parent d58e9f0 commit 02ebcfe
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions internal/mode/static/state/graph/route_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,7 @@ func TestAllowedRouteType(t *testing.T) {
})
}
}

func TestBindL4RouteToListeners(t *testing.T) {
// we create a new listener each time because the function under test can modify it
createListener := func(name string) *Listener {
Expand Down
39 changes: 25 additions & 14 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@ GW_SVC_GKE_INTERNAL = false
NGF_VERSION ?= $(shell git describe --tags $(shell git rev-list --tags --max-count=1))## NGF version to be tested (defaults to latest tag)
PULL_POLICY = Never## Pull policy for the images
PROVISIONER_MANIFEST = conformance/provisioner/provisioner.yaml
SUPPORTED_FEATURES = HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,GatewayPort8080,HTTPRouteResponseHeaderModification,GRPCExactMethodMatching,GRPCRouteListenerHostnameMatching,GRPCRouteHeaderMatching,TLSRoute
SUPPORTED_EXTENDED_FEATURES = HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,GatewayPort8080,HTTPRouteResponseHeaderModification
STANDARD_CONFORMANCE_PROFILES = GATEWAY-HTTP,GATEWAY-GRPC
EXPERIMENTAL_CONFORMANCE_PROFILES = GATEWAY-TLS
CONFORMANCE_PROFILES = $(STANDARD_CONFORMANCE_PROFILES) # by default we use the standard conformance profiles. If experimental is enabled we override this and add the experimental profiles.
SKIP_TESTS = TLSRouteInvalidReferenceGrant

ifneq ($(GINKGO_LABEL),)
override GINKGO_FLAGS += --label-filter "$(GINKGO_LABEL)"
endif

# Check if ENABLE_EXPERIMENTAL is true
ifeq ($(ENABLE_EXPERIMENTAL),true)
# If true, add the experimental conformance profiles
CONFORMANCE_PROFILES = $(EXPERIMENTAL_CONFORMANCE_PROFILES),$(STANDARD_CONFORMANCE_PROFILES)
endif


.PHONY: update-go-modules
update-go-modules: ## Update the gateway-api go modules to latest main version
go get -u sigs.k8s.io/gateway-api@main
Expand All @@ -35,9 +46,9 @@ run-conformance-tests: ## Run conformance tests
--image=$(CONFORMANCE_PREFIX):$(CONFORMANCE_TAG) --image-pull-policy=Never \
--overrides='{ "spec": { "serviceAccountName": "conformance" } }' \
--restart=Never -- sh -c "go test -v . -tags conformance,experimental -args --gateway-class=$(GATEWAY_CLASS) \
--supported-features=$(SUPPORTED_FEATURES) --version=$(NGF_VERSION) --skip-tests=TLSRouteInvalidReferenceGrant \
--supported-features=$(SUPPORTED_EXTENDED_FEATURES) --version=$(NGF_VERSION) --skip-tests=$(SKIP_TESTS) --conformance-profiles=$(CONFORMANCE_PROFILES) \
--report-output=output.txt; cat output.txt" | tee output.txt
./scripts/check-pod-exit-code.sh
bash scripts/check-pod-exit-code.sh
sed -e '1,/CONFORMANCE PROFILE/d' output.txt > conformance-profile.yaml
rm output.txt
grpc_core_result=`yq '.profiles[0].core.result' conformance-profile.yaml`; \
Expand Down Expand Up @@ -78,27 +89,27 @@ setup-gcp-and-run-nfr-tests: create-gke-router create-and-setup-vm nfr-test ## C

.PHONY: create-gke-cluster
create-gke-cluster: ## Create a GKE cluster
./scripts/create-gke-cluster.sh $(CI)
bash scripts/create-gke-cluster.sh $(CI)

.PHONY: create-and-setup-vm
create-and-setup-vm: ## Create and setup a GCP VM for tests
./scripts/create-and-setup-gcp-vm.sh
bash scripts/create-and-setup-gcp-vm.sh

.PHONY: create-gke-router
create-gke-router: ## Create a GKE router to allow egress traffic from private nodes (allows for external image pulls)
./scripts/create-gke-router.sh
bash scripts/create-gke-router.sh

.PHONY: sync-files-to-vm
sync-files-to-vm: ## Syncs your local NGF files with the NGF repo on the VM
./scripts/sync-files-to-vm.sh
bash scripts/sync-files-to-vm.sh

.PHONY: run-tests-on-vm
run-tests-on-vm: ## Run the functional tests on a GCP VM
./scripts/run-tests-gcp-vm.sh
bash scripts/run-tests-gcp-vm.sh

.PHONY: nfr-test
nfr-test: ## Run the NFR tests on a GCP VM
NFR=true CI=$(CI) ./scripts/run-tests-gcp-vm.sh
NFR=true CI=$(CI) bash scripts/run-tests-gcp-vm.sh

.PHONY: start-longevity-test
start-longevity-test: export START_LONGEVITY=true
Expand Down Expand Up @@ -136,19 +147,19 @@ cleanup-gcp: cleanup-router cleanup-vm delete-gke-cluster ## Cleanup all GCP res

.PHONY: cleanup-router
cleanup-router: ## Delete the GKE router
./scripts/cleanup-router.sh
bash scripts/cleanup-router.sh

.PHONY: cleanup-vm
cleanup-vm: ## Delete the test GCP VM and delete the firewall rule
./scripts/cleanup-vm.sh
bash scripts/cleanup-vm.sh

.PHONY: delete-gke-cluster
delete-gke-cluster: ## Delete the GKE cluster
./scripts/delete-gke-cluster.sh
bash scripts/delete-gke-cluster.sh

.PHONY: add-local-ip-to-cluster
add-local-ip-to-cluster: ## Add local IP to the GKE cluster master-authorized-networks
./scripts/add-local-ip-auth-networks.sh
bash scripts/add-local-ip-auth-networks.sh

HELM_PARAMETERS += --set nameOverride=nginx-gateway --set nginxGateway.kind=skip --set service.create=false

Expand All @@ -159,7 +170,7 @@ deploy-updated-provisioner: ## Update provisioner manifest and deploy to the con

.PHONY: generate-static-deployment
generate-static-deployment:
helm template nginx-gateway $(CHART_DIR) --set nameOverride=nginx-gateway --set metrics.enable=false --set nginxGateway.productTelemetry.enable=false -n nginx-gateway -s templates/deployment.yaml --set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never --set nginxGateway.gwAPIExperimentalFeatures.enable=$(ENABLE_EXPERIMENTAL) --set nginx.plus=$(PLUS_ENABLED) > $(SELF_DIR)config/tests/static-deployment.yaml
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set metrics.enable=false --set nginxGateway.productTelemetry.enable=false -n nginx-gateway -s templates/deployment.yaml --set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never --set nginxGateway.gwAPIExperimentalFeatures.enable=$(ENABLE_EXPERIMENTAL) --set nginx.plus=$(PLUS_ENABLED) > $(SELF_DIR)config/tests/static-deployment.yaml

# this target is used to install the gateway-api CRDs from the main branch (only used in the nightly CI job)
# it overrides the target in the main Makefile when the GW_API_VERSION is set to main
Expand Down
13 changes: 5 additions & 8 deletions tests/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"testing"

. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/gateway-api/conformance"
conf_v1 "sigs.k8s.io/gateway-api/conformance/apis/v1"
"sigs.k8s.io/gateway-api/conformance/tests"
Expand All @@ -35,9 +34,12 @@ func TestConformance(t *testing.T) {
g := NewWithT(t)

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]`,
`debug: %t\n enable all features: %t \n supported extended features: [%v]\n exempt features: [%v]\n`+
`conformance profiles: [%v]\n skip tests: [%v]`,
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug,
*flags.EnableAllSupportedFeatures, *flags.SupportedFeatures, *flags.ExemptFeatures)
*flags.EnableAllSupportedFeatures, *flags.SupportedFeatures, *flags.ExemptFeatures,
*flags.ConformanceProfiles, *flags.SkipTests,
)

opts := conformance.DefaultOptions(t)
opts.Implementation = conf_v1.Implementation{
Expand All @@ -49,11 +51,6 @@ func TestConformance(t *testing.T) {
"https://github.com/nginxinc/nginx-gateway-fabric/discussions/new/choose",
},
}
opts.ConformanceProfiles = sets.New(
suite.GatewayHTTPConformanceProfileName,
suite.GatewayGRPCConformanceProfileName,
suite.GatewayTLSConformanceProfileName,
)

testSuite, err := suite.NewConformanceTestSuite(opts)
g.Expect(err).To(Not(HaveOccurred()))
Expand Down

0 comments on commit 02ebcfe

Please sign in to comment.