99 . "github.com/onsi/gomega"
1010 "github.com/spf13/cobra"
1111 "github.com/spf13/pflag"
12- "k8s.io/apimachinery/pkg/types"
1312
1413 "github.com/nginx/nginx-gateway-fabric/internal/mode/static/config"
1514)
@@ -63,8 +62,6 @@ func TestCommonFlagsValidation(t *testing.T) {
6362 args : []string {
6463 "--gateway-ctlr-name=gateway.nginx.org/nginx-gateway" ,
6564 "--gatewayclass=nginx" ,
66- "--gateway=nginx-gateway/nginx" ,
67- "--config=nginx-gateway-config" ,
6865 },
6966 wantErr : false ,
7067 },
@@ -139,7 +136,6 @@ func TestControllerCmdFlagValidation(t *testing.T) {
139136 args : []string {
140137 "--gateway-ctlr-name=gateway.nginx.org/nginx-gateway" , // common and required flag
141138 "--gatewayclass=nginx" , // common and required flag
142- "--gateway=nginx-gateway/nginx" ,
143139 "--config=nginx-gateway-config" ,
144140 "--service=nginx-gateway" ,
145141 "--agent-tls-secret=agent-tls" ,
@@ -171,23 +167,6 @@ func TestControllerCmdFlagValidation(t *testing.T) {
171167 },
172168 wantErr : false ,
173169 },
174- {
175- name : "gateway is set to empty string" ,
176- args : []string {
177- "--gateway=" ,
178- },
179- wantErr : true ,
180- expectedErrPrefix : `invalid argument "" for "--gateway" flag: must be set` ,
181- },
182- {
183- name : "gateway is invalid" ,
184- args : []string {
185- "--gateway=nginx-gateway" , // no namespace
186- },
187- wantErr : true ,
188- expectedErrPrefix : `invalid argument "nginx-gateway" for "--gateway" flag: invalid format; ` +
189- "must be NAMESPACE/NAME" ,
190- },
191170 {
192171 name : "config is set to empty string" ,
193172 args : []string {
@@ -712,30 +691,6 @@ func TestParseFlags(t *testing.T) {
712691 err = flagSet .Set ("customStringFlagUserDefined" , "changed-test-flag-value" )
713692 g .Expect (err ).To (Not (HaveOccurred ()))
714693
715- customStringFlagNoDefaultValueUnset := namespacedNameValue {
716- value : types.NamespacedName {},
717- }
718- flagSet .Var (
719- & customStringFlagNoDefaultValueUnset ,
720- "customStringFlagNoDefaultValueUnset" ,
721- "no default value custom string test flag" ,
722- )
723-
724- customStringFlagNoDefaultValueUserDefined := namespacedNameValue {
725- value : types.NamespacedName {},
726- }
727- flagSet .Var (
728- & customStringFlagNoDefaultValueUserDefined ,
729- "customStringFlagNoDefaultValueUserDefined" ,
730- "no default value but with user defined namespacedName test flag" ,
731- )
732- userDefinedNamespacedName := types.NamespacedName {
733- Namespace : "changed-namespace" ,
734- Name : "changed-name" ,
735- }
736- err = flagSet .Set ("customStringFlagNoDefaultValueUserDefined" , userDefinedNamespacedName .String ())
737- g .Expect (err ).To (Not (HaveOccurred ()))
738-
739694 expectedKeys := []string {
740695 "boolFlagTrue" ,
741696 "boolFlagFalse" ,
@@ -745,9 +700,6 @@ func TestParseFlags(t *testing.T) {
745700
746701 "customStringFlagDefault" ,
747702 "customStringFlagUserDefined" ,
748-
749- "customStringFlagNoDefaultValueUnset" ,
750- "customStringFlagNoDefaultValueUserDefined" ,
751703 }
752704 expectedValues := []string {
753705 "true" ,
@@ -758,9 +710,6 @@ func TestParseFlags(t *testing.T) {
758710
759711 "default" ,
760712 "user-defined" ,
761-
762- "default" ,
763- "user-defined" ,
764713 }
765714
766715 flagKeys , flagValues := parseFlags (flagSet )
0 commit comments