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

Add options for chart version and add command output #2332

Merged
merged 3 commits into from
Aug 7, 2024
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
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ linters-settings:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
arguments:
- allowedPackages:
- github.com/onsi/gomega
- github.com/onsi/ginkgo/v2
- name: empty-block
- name: error-naming
- name: error-return
Expand Down Expand Up @@ -40,6 +45,10 @@ linters-settings:
dupword:
ignore:
- "test"
stylecheck:
dot-import-whitelist:
- github.com/onsi/gomega
- github.com/onsi/ginkgo/v2
linters:
enable:
- asasalint
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GW_API_VERSION ?= $(shell sed -n 's/.*ref=v\(.*\)/\1/p' ../config/crd/gateway-ap
GW_API_PREV_VERSION ?= 1.1.0## Supported Gateway API version from previous NGF release
GW_SERVICE_TYPE = NodePort## Service type to use for the gateway
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)
NGF_VERSION ?= edge## NGF version to be tested
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
Expand Down
14 changes: 14 additions & 0 deletions tests/framework/ngf.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
core "k8s.io/api/core/v1"
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -22,6 +23,7 @@ type InstallationConfig struct {
ReleaseName string
Namespace string
ChartPath string
ChartVersion string
NgfImageRepository string
NginxImageRepository string
ImageTag string
Expand Down Expand Up @@ -58,17 +60,23 @@ func UninstallGatewayAPI(apiVersion string) ([]byte, error) {
func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
args := []string{
"install",
"--debug",
cfg.ReleaseName,
cfg.ChartPath,
"--create-namespace",
"--namespace", cfg.Namespace,
"--wait",
"--set", "nginxGateway.productTelemetry.enable=false",
}
if cfg.ChartVersion != "" {
args = append(args, "--version", cfg.ChartVersion)
}

args = append(args, setImageArgs(cfg)...)
fullArgs := append(args, extraArgs...)

GinkgoWriter.Printf("Installing NGF with command: helm %v\n", strings.Join(fullArgs, " "))

return exec.Command("helm", fullArgs...).CombinedOutput()
}

Expand All @@ -81,16 +89,22 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {

args := []string{
"upgrade",
"--debug",
cfg.ReleaseName,
cfg.ChartPath,
"--namespace", cfg.Namespace,
"--wait",
"--set", "nginxGateway.productTelemetry.enable=false",
}
if cfg.ChartVersion != "" {
args = append(args, "--version", cfg.ChartVersion)
}

args = append(args, setImageArgs(cfg)...)
fullArgs := append(args, extraArgs...)

GinkgoWriter.Printf("Upgrading NGF with command: helm %v\n", strings.Join(fullArgs, " "))

return exec.Command("helm", fullArgs...).CombinedOutput()
}

Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/sync-files-to-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -eo pipefail

source scripts/vars.env

NGF_DIR=$(dirname "$PWD")
NGF_DIR=$(dirname "$PWD")/

gcloud compute config-ssh --ssh-config-file ngf-gcp.ssh >/dev/null

rsync -ave 'ssh -F ngf-gcp.ssh' "${NGF_DIR}" username@"${RESOURCE_NAME}"."${GKE_CLUSTER_ZONE}"."${GKE_PROJECT}":~
rsync -ave 'ssh -F ngf-gcp.ssh' "${NGF_DIR}" username@"${RESOURCE_NAME}"."${GKE_CLUSTER_ZONE}"."${GKE_PROJECT}":~/nginx-gateway-fabric
sjberman marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions tests/suite/system_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var (
localChartPath string
address string
version string
chartVersion string
lucacome marked this conversation as resolved.
Show resolved Hide resolved
clusterInfo framework.ClusterInfo
skipNFRTests bool
)
Expand Down Expand Up @@ -173,6 +174,11 @@ func setup(cfg setupConfig, extraInstallArgs ...string) {
}
installCfg.ImageTag = *imageTag
installCfg.ImagePullPolicy = *imagePullPolicy
} else {
if version == "edge" {
chartVersion = "0.0.0-edge"
installCfg.ChartVersion = chartVersion
lucacome marked this conversation as resolved.
Show resolved Hide resolved
}
}
lucacome marked this conversation as resolved.
Show resolved Hide resolved

output, err := framework.InstallGatewayAPI(cfg.gwAPIVersion)
Expand Down
1 change: 1 addition & 0 deletions tests/suite/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var _ = Describe("Upgrade testing", Label("nfr", "upgrade"), func() {
ReleaseName: releaseName,
Namespace: ngfNamespace,
ChartPath: localChartPath,
ChartVersion: chartVersion,
NgfImageRepository: *ngfImageRepository,
NginxImageRepository: nginxImage,
ImageTag: *imageTag,
Expand Down
Loading