Skip to content

Commit

Permalink
enable and update endpoint for telemetry for longevity tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salonichf5 committed Nov 27, 2024
1 parent cafbd5c commit 4b818fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- release-*
- tests/telemetry-*
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
Expand Down Expand Up @@ -180,7 +181,7 @@ jobs:
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }}
TELEMETRY_ENDPOINT: oss.edge.df.f5.com:443
TELEMETRY_ENDPOINT: ${{ github.event == 'push' && startsWith(github.ref, 'refs/heads/tests/') && 'oss-dev.edge.df.f5.com:443' || 'oss.edge.df.f5.com:443' }}

Check failure on line 184 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / Actionlint

[actionlint] reported by reviewdog 🐶 "object" value cannot be compared to "string" value with "==" operator [expression] Raw Output: .github/workflows/ci.yml:184:35: "object" value cannot be compared to "string" value with "==" operator [expression]
TELEMETRY_ENDPOINT_INSECURE: "false"

- name: Cache Artifacts
Expand Down
2 changes: 2 additions & 0 deletions cmd/gateway/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ func createStaticModeCommand() *cobra.Command {
}
}

fmt.Println("telemetry endpoint set to ", telemetryEndpoint)

Check warning on line 194 in cmd/gateway/commands.go

View check run for this annotation

Codecov / codecov/patch

cmd/gateway/commands.go#L193-L194

Added lines #L193 - L194 were not covered by tests
telemetryEndpointInsecure, err := strconv.ParseBool(telemetryEndpointInsecure)
if err != nil {
return fmt.Errorf("error parsing telemetry endpoint insecure: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ stop-longevity-test: nfr-test ## Stop the longevity test and collects results

.PHONY: .vm-nfr-test
.vm-nfr-test: ## Runs the NFR tests on the GCP VM (called by `nfr-test`)
go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending \
go run github.com/onsi/ginkgo/v2/ginkgo -v --randomize-all --randomize-suites --keep-going --fail-on-pending \
--trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \
--label-filter "nfr" $(GINKGO_FLAGS) --timeout 5h ./suite -- --gateway-api-version=$(GW_API_VERSION) \
--gateway-api-prev-version=$(GW_API_PREV_VERSION) --image-tag=$(TAG) --version-under-test=$(NGF_VERSION) \
Expand Down
16 changes: 14 additions & 2 deletions tests/framework/ngf.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type InstallationConfig struct {
ServiceType string
IsGKEInternalLB bool
Plus bool
Telemetry bool
}

// InstallGatewayAPI installs the specified version of the Gateway API resources.
Expand Down Expand Up @@ -70,14 +71,14 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
"--create-namespace",
"--namespace", cfg.Namespace,
"--wait",
"--set", "nginxGateway.productTelemetry.enable=false",
"--set", "nginxGateway.snippetsFilters.enable=true",
}
if cfg.ChartVersion != "" {
args = append(args, "--version", cfg.ChartVersion)
}

args = append(args, setImageArgs(cfg)...)
args = append(args, setTelemetryArgs(cfg)...)
fullArgs := append(args, extraArgs...) //nolint:gocritic

GinkgoWriter.Printf("Installing NGF with command: helm %v\n", strings.Join(fullArgs, " "))
Expand Down Expand Up @@ -136,7 +137,6 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
cfg.ChartPath,
"--namespace", cfg.Namespace,
"--wait",
"--set", "nginxGateway.productTelemetry.enable=false",
"--set", "nginxGateway.config.logging.level=debug",
"--set", "nginxGateway.snippetsFilter.enable=true",
}
Expand All @@ -145,6 +145,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
}

args = append(args, setImageArgs(cfg)...)
args = append(args, setTelemetryArgs(cfg)...)
fullArgs := append(args, extraArgs...) //nolint:gocritic

GinkgoWriter.Printf("Upgrading NGF with command: helm %v\n", strings.Join(fullArgs, " "))
Expand Down Expand Up @@ -188,6 +189,17 @@ func UninstallNGF(cfg InstallationConfig, k8sClient client.Client) ([]byte, erro
return nil, nil
}

func setTelemetryArgs(cfg InstallationConfig) []string {
var args []string

args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "false")...)
if cfg.Telemetry {
GinkgoWriter.Printf("Telemetry set to %v\n", cfg.Telemetry)
args = append(args, formatValueSet("nginxGateway.productTelemetry.enable", "true")...)
}
return args
}

func setImageArgs(cfg InstallationConfig) []string {
var args []string

Expand Down
6 changes: 6 additions & 0 deletions tests/suite/system_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type setupConfig struct {
deploy bool
nfr bool
debugLogLevel bool
telemetry bool
}

func setup(cfg setupConfig, extraInstallArgs ...string) {
Expand Down Expand Up @@ -151,6 +152,10 @@ func setup(cfg setupConfig, extraInstallArgs ...string) {
Skip("Graceful Recovery test must be run on Kind")
}

if clusterInfo.IsGKE && strings.Contains(GinkgoLabelFilter(), "longevity") {
cfg.telemetry = true
}

switch {
case *versionUnderTest != "":
version = *versionUnderTest
Expand Down Expand Up @@ -196,6 +201,7 @@ func createNGFInstallConfig(cfg setupConfig, extraInstallArgs ...string) framewo
ServiceType: *serviceType,
IsGKEInternalLB: *isGKEInternalLB,
Plus: *plusEnabled,
Telemetry: cfg.telemetry,
}

// if we aren't installing from the public charts, then set the custom images
Expand Down

0 comments on commit 4b818fa

Please sign in to comment.