Merge pull request #79956 from johnharris85/logs-error-typo

Fix 'concurrency' logs typo
This commit is contained in:
Kubernetes Prow Robot 2019-07-30 01:59:43 -07:00 committed by GitHub
commit bd6eaa5e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -107,7 +107,7 @@ type LogsOptions struct {
// whether or not a container name was given via --container // whether or not a container name was given via --container
ContainerNameSpecified bool ContainerNameSpecified bool
Selector string Selector string
MaxFollowConcurency int MaxFollowConcurrency int
Object runtime.Object Object runtime.Object
GetPodTimeout time.Duration GetPodTimeout time.Duration
@ -121,10 +121,10 @@ type LogsOptions struct {
func NewLogsOptions(streams genericclioptions.IOStreams, allContainers bool) *LogsOptions { func NewLogsOptions(streams genericclioptions.IOStreams, allContainers bool) *LogsOptions {
return &LogsOptions{ return &LogsOptions{
IOStreams: streams, IOStreams: streams,
AllContainers: allContainers, AllContainers: allContainers,
Tail: -1, Tail: -1,
MaxFollowConcurency: 5, MaxFollowConcurrency: 5,
} }
} }
@ -162,7 +162,7 @@ func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
cmd.Flags().StringVarP(&o.Container, "container", "c", o.Container, "Print the logs of this container") cmd.Flags().StringVarP(&o.Container, "container", "c", o.Container, "Print the logs of this container")
cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodLogsTimeout) cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodLogsTimeout)
cmd.Flags().StringVarP(&o.Selector, "selector", "l", o.Selector, "Selector (label query) to filter on.") cmd.Flags().StringVarP(&o.Selector, "selector", "l", o.Selector, "Selector (label query) to filter on.")
cmd.Flags().IntVar(&o.MaxFollowConcurency, "max-log-requests", o.MaxFollowConcurency, "Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.") cmd.Flags().IntVar(&o.MaxFollowConcurrency, "max-log-requests", o.MaxFollowConcurrency, "Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.")
return cmd return cmd
} }
@ -308,10 +308,10 @@ func (o LogsOptions) RunLogs() error {
} }
if o.Follow && len(requests) > 1 { if o.Follow && len(requests) > 1 {
if len(requests) > o.MaxFollowConcurency { if len(requests) > o.MaxFollowConcurrency {
return fmt.Errorf( return fmt.Errorf(
"you are attempting to follow %d log streams, but maximum allowed concurency is %d, use --max-log-requests to increase the limit", "you are attempting to follow %d log streams, but maximum allowed concurrency is %d, use --max-log-requests to increase the limit",
len(requests), o.MaxFollowConcurency, len(requests), o.MaxFollowConcurrency,
) )
} }

View File

@ -108,7 +108,7 @@ func TestLog(t *testing.T) {
}, },
}, },
{ {
name: "fail to follow logs from multiple requests when there are more logs sources then MaxFollowConcurency allows", name: "fail to follow logs from multiple requests when there are more logs sources then MaxFollowConcurrency allows",
opts: func(streams genericclioptions.IOStreams) *LogsOptions { opts: func(streams genericclioptions.IOStreams) *LogsOptions {
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
mock := &logTestMock{ mock := &logTestMock{
@ -124,11 +124,11 @@ func TestLog(t *testing.T) {
o := NewLogsOptions(streams, false) o := NewLogsOptions(streams, false)
o.LogsForObject = mock.mockLogsForObject o.LogsForObject = mock.mockLogsForObject
o.ConsumeRequestFn = mock.mockConsumeRequest o.ConsumeRequestFn = mock.mockConsumeRequest
o.MaxFollowConcurency = 2 o.MaxFollowConcurrency = 2
o.Follow = true o.Follow = true
return o return o
}, },
expectedErr: "you are attempting to follow 3 log streams, but maximum allowed concurency is 2, use --max-log-requests to increase the limit", expectedErr: "you are attempting to follow 3 log streams, but maximum allowed concurrency is 2, use --max-log-requests to increase the limit",
}, },
{ {
name: "fail if LogsForObject fails", name: "fail if LogsForObject fails",