You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--public-key-file string Path to the file that contains a public SSH key. If not given, a temporary keypair will be generated.
61
61
--seed string target the given seed cluster
62
+
--shell string Shell to use for escaping arguments when printing out the SSH command. If not provided, it defaults to the GCTL_SHELL environment variable or bash.
62
63
--shoot string target the given shoot cluster
63
64
--skip-availability-check Skip checking for SSH bastion host availability.
64
65
--user string user is the name of the Shoot cluster node ssh login username. (default "gardener")
@@ -203,7 +211,13 @@ func (o *options) Validate() error {
203
211
returnpflag.ErrHelp
204
212
}
205
213
206
-
// Usually, we would check and return an error if both shell and output are set (not empty). However, this is not required because the output flag is not set for the shell subcommands.
214
+
ifo.Shell!=""&&o.Output!="" {
215
+
returnfmt.Errorf("internal error: both shell and output are set")
216
+
}
217
+
218
+
ifo.Output!=""&&o.Template!=nil {
219
+
returnfmt.Errorf("internal error: template is set when output is specified")
Set-Alias -Name g -Value (get-command gardenctl).Path -Option AllScope -Force
@@ -229,5 +233,39 @@ gk
229
233
options.Prefix="!"
230
234
Expect(options.Validate()).To(MatchError("prefix must start with an alphabetic character may be followed by alphanumeric characters, underscore or dash"))
231
235
})
236
+
It("should return an error when the prefix is too long", func() {
Expect(options.Validate()).To(MatchError("prefix is too long, maximum length is 32 characters"))
239
+
})
240
+
241
+
It("should allow valid prefix with alphanumeric characters", func() {
242
+
options.Prefix="gctl123"
243
+
Expect(options.Validate()).To(Succeed())
244
+
})
245
+
246
+
It("should allow valid prefix with underscore", func() {
247
+
options.Prefix="g_ctl"
248
+
Expect(options.Validate()).To(Succeed())
249
+
})
250
+
251
+
It("should allow valid prefix with dash", func() {
252
+
options.Prefix="g-ctl"
253
+
Expect(options.Validate()).To(Succeed())
254
+
})
255
+
256
+
It("should return an error when prefix starts with a number", func() {
257
+
options.Prefix="1gctl"
258
+
Expect(options.Validate()).To(MatchError("prefix must start with an alphabetic character may be followed by alphanumeric characters, underscore or dash"))
259
+
})
260
+
261
+
It("should return an error when prefix starts with underscore", func() {
262
+
options.Prefix="_gctl"
263
+
Expect(options.Validate()).To(MatchError("prefix must start with an alphabetic character may be followed by alphanumeric characters, underscore or dash"))
264
+
})
265
+
266
+
It("should return an error when prefix starts with dash", func() {
267
+
options.Prefix="-gctl"
268
+
Expect(options.Validate()).To(MatchError("prefix must start with an alphabetic character may be followed by alphanumeric characters, underscore or dash"))
0 commit comments