Scenario 7: Whitespace-Only DNS Zone RG Name

Objective: Verify that whitespace-only --dns-zone-rg-name values are rejected by strings.TrimSpace validation.

Result: PASS — Whitespace-only value treated as empty. strings.TrimSpace correctly strips whitespace before comparison.

Command

$ hypershift create cluster azure \
    --name test-s7 \
    --azure-creds creds.yaml \
    --assign-service-principal-roles \
    --dns-zone-rg-name "   " \
    --pull-secret pull-secret.json \
    --release-image quay.io/openshift-release-dev/ocp-release:4.18.0-x86_64 \
    --workload-identities-file wi.json \
    --render --render-into /dev/null

Full Output

{"level":"error","ts":"2026-06-17T10:30:18-04:00","msg":"Failed to create cluster","error":"--dns-zone-rg-name is required when --assign-service-principal-roles or --assign-custom-hcp-roles is set","stacktrace":"github.com/openshift/hypershift/cmd/cluster/azure.NewCreateCommand.func1
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/cmd/cluster/azure/create.go:64
github.com/spf13/cobra.(*Command).execute
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1015
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1148
github.com/spf13/cobra.(*Command).Execute
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1064
main.main
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/main.go:80
runtime.main
	/opt/homebrew/Cellar/go/1.26.0/libexec/src/runtime/proc.go:290"}
Error: --dns-zone-rg-name is required when --assign-service-principal-roles or --assign-custom-hcp-roles is set
--dns-zone-rg-name is required when --assign-service-principal-roles or --assign-custom-hcp-roles is set

Exit code: 1

Verification

CheckResult
Command exits with non-zero codePASS — Exit code: 1
TrimSpace catches whitespace-only valuePASS — Same error as empty string
Whitespace not treated as valid valuePASSstrings.TrimSpace(" ") == ""
← Scenario 6 Dashboard →