diff --git a/tests/Makefile b/tests/Makefile index a68ab7e120..b4e34787ee 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -130,7 +130,8 @@ stop-longevity-test: nfr-test ## Stop the longevity test and collects results --ngf-image-repo=$(PREFIX) --nginx-image-repo=$(NGINX_PREFIX) --nginx-plus-image-repo=$(NGINX_PLUS_PREFIX) \ --pull-policy=$(PULL_POLICY) --service-type=$(GW_SERVICE_TYPE) \ --is-gke-internal-lb=$(GW_SVC_GKE_INTERNAL) --plus-enabled=$(PLUS_ENABLED) \ - --plus-license-file-name=$(PLUS_LICENSE_FILE) --plus-usage-endpoint=$(PLUS_USAGE_ENDPOINT) + --plus-license-file-name=$(PLUS_LICENSE_FILE) --plus-usage-endpoint=$(PLUS_USAGE_ENDPOINT) \ + --gke-project=$(GKE_PROJECT) .PHONY: test test: build-crossplane-image ## Runs the functional tests on your kind k8s cluster diff --git a/tests/framework/ngf.go b/tests/framework/ngf.go index 80c0f59abc..45a1eeecc9 100644 --- a/tests/framework/ngf.go +++ b/tests/framework/ngf.go @@ -148,6 +148,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { args = append(args, setImageArgs(cfg)...) args = append(args, setTelemetryArgs(cfg)...) + args = append(args, setPlusUsageEndpointArg(cfg)...) fullArgs := append(args, extraArgs...) //nolint:gocritic GinkgoWriter.Printf("Upgrading NGF with command: helm %v\n", strings.Join(fullArgs, " ")) diff --git a/tests/scripts/remote-scripts/run-nfr-tests.sh b/tests/scripts/remote-scripts/run-nfr-tests.sh index 467236d01a..5fbe5450d0 100755 --- a/tests/scripts/remote-scripts/run-nfr-tests.sh +++ b/tests/scripts/remote-scripts/run-nfr-tests.sh @@ -10,7 +10,7 @@ elif [ "${STOP_LONGEVITY}" == "true" ]; then GINKGO_LABEL="longevity-teardown" fi -cd nginx-gateway-fabric/tests && make .vm-nfr-test CI=${CI} TAG="${TAG}" PREFIX="${PREFIX}" NGINX_PREFIX="${NGINX_PREFIX}" NGINX_PLUS_PREFIX="${NGINX_PLUS_PREFIX}" PLUS_ENABLED="${PLUS_ENABLED}" GINKGO_LABEL=${GINKGO_LABEL} GINKGO_FLAGS="${GINKGO_FLAGS}" PULL_POLICY=Always GW_SERVICE_TYPE=LoadBalancer GW_SVC_GKE_INTERNAL=true NGF_VERSION="${NGF_VERSION}" PLUS_USAGE_ENDPOINT="${PLUS_USAGE_ENDPOINT}" +cd nginx-gateway-fabric/tests && make .vm-nfr-test CI=${CI} TAG="${TAG}" PREFIX="${PREFIX}" NGINX_PREFIX="${NGINX_PREFIX}" NGINX_PLUS_PREFIX="${NGINX_PLUS_PREFIX}" PLUS_ENABLED="${PLUS_ENABLED}" GINKGO_LABEL=${GINKGO_LABEL} GINKGO_FLAGS="${GINKGO_FLAGS}" PULL_POLICY=Always GW_SERVICE_TYPE=LoadBalancer GW_SVC_GKE_INTERNAL=true NGF_VERSION="${NGF_VERSION}" PLUS_USAGE_ENDPOINT="${PLUS_USAGE_ENDPOINT}" GKE_PROJECT="${GKE_PROJECT}" if [ "${START_LONGEVITY}" == "true" ]; then suite/scripts/longevity-wrk.sh diff --git a/tests/scripts/vars.env-example b/tests/scripts/vars.env-example index 6289b91f87..b8f1276fb5 100644 --- a/tests/scripts/vars.env-example +++ b/tests/scripts/vars.env-example @@ -18,6 +18,7 @@ GINKGO_FLAGS= SOURCE_IP_RANGE= ADD_VM_IP_AUTH_NETWORKS= PLUS_ENABLED= +PLUS_USAGE_ENDPOINT= NGF_VERSION= GKE_MACHINE_TYPE= GKE_NUM_NODES= diff --git a/tests/suite/system_suite_test.go b/tests/suite/system_suite_test.go index 4bfb834ab8..cb8640abfd 100644 --- a/tests/suite/system_suite_test.go +++ b/tests/suite/system_suite_test.go @@ -64,6 +64,7 @@ var ( plusLicenseFileName = flag.String("plus-license-file-name", "", "File name containing the NGINX Plus JWT") plusUsageEndpoint = flag.String("plus-usage-endpoint", "", "Endpoint for reporting NGINX Plus usage") clusterName = flag.String("cluster-name", "kind", "Cluster name") + gkeProject = flag.String("gke-project", "", "GKE Project name") ) var ( @@ -84,6 +85,8 @@ var ( logs string ) +var formatNginxPlusEdgeImagePath = "us-docker.pkg.dev/%s/nginx-gateway-fabric/nginx-plus" + const ( releaseName = "ngf-test" ngfNamespace = "nginx-gateway" @@ -206,8 +209,9 @@ func createNGFInstallConfig(cfg setupConfig, extraInstallArgs ...string) framewo Telemetry: cfg.telemetry, } + switch { // if we aren't installing from the public charts, then set the custom images - if !strings.HasPrefix(cfg.chartPath, "oci://") { + case !strings.HasPrefix(cfg.chartPath, "oci://"): installCfg.NgfImageRepository = *ngfImageRepository installCfg.NginxImageRepository = *nginxImageRepository if *plusEnabled && cfg.nfr { @@ -215,9 +219,14 @@ func createNGFInstallConfig(cfg setupConfig, extraInstallArgs ...string) framewo } installCfg.ImageTag = *imageTag installCfg.ImagePullPolicy = *imagePullPolicy - } else if version == "edge" { + case version == "edge": chartVersion = "0.0.0-edge" installCfg.ChartVersion = chartVersion + if *plusEnabled && cfg.nfr { + installCfg.NginxImageRepository = fmt.Sprintf(formatNginxPlusEdgeImagePath, *gkeProject) + } + case *plusEnabled && cfg.nfr: + installCfg.NginxImageRepository = fmt.Sprintf(formatNginxPlusEdgeImagePath, *gkeProject) } output, err := framework.InstallGatewayAPI(cfg.gwAPIVersion) diff --git a/tests/suite/upgrade_test.go b/tests/suite/upgrade_test.go index 0ca7923872..07ba45671f 100644 --- a/tests/suite/upgrade_test.go +++ b/tests/suite/upgrade_test.go @@ -101,6 +101,7 @@ var _ = Describe("Upgrade testing", Label("nfr", "upgrade"), func() { ServiceType: *serviceType, IsGKEInternalLB: *isGKEInternalLB, Plus: *plusEnabled, + PlusUsageEndpoint: *plusUsageEndpoint, } type metricsResults struct {