Skip to content

Commit

Permalink
Refresh token in logs is disabled for Korifi
Browse files Browse the repository at this point in the history
- Configured with `Config.IsCFOnK8s`

Co-authored-by: Clint Yoshimura <clinty@vmware.com>
  • Loading branch information
2 people authored and a-b committed Aug 23, 2022
1 parent aa71003 commit 6270f99
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
23 changes: 13 additions & 10 deletions command/v7/logs_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,23 @@ func (cmd LogsCommand) Execute(args []string) error {
return cmd.displayRecentLogs()
}

stop := make(chan struct{})
stoppedRefreshing := make(chan struct{})
stoppedOutputtingRefreshErrors := make(chan struct{})
err = cmd.refreshTokenPeriodically(stop, stoppedRefreshing, stoppedOutputtingRefreshErrors)
if err != nil {
return err
if !cmd.Config.IsCFOnK8s() {
stop := make(chan struct{})
stoppedRefreshing := make(chan struct{})
stoppedOutputtingRefreshErrors := make(chan struct{})
err = cmd.refreshTokenPeriodically(stop, stoppedRefreshing, stoppedOutputtingRefreshErrors)
if err != nil {
return err
}
defer func() {
close(stop)
<-stoppedRefreshing
<-stoppedOutputtingRefreshErrors
}()
}

err = cmd.streamLogs()

close(stop)
<-stoppedRefreshing
<-stoppedOutputtingRefreshErrors

return err
}

Expand Down
10 changes: 10 additions & 0 deletions command/v7/logs_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ var _ = Describe("logs command", func() {
})
})

When("isCFOnK8s is true", func() {
BeforeEach(func() {
fakeConfig.IsCFOnK8sReturns(true)
})

It("does not call ScheduleTokenRefresh", func() {
Expect(fakeActor.ScheduleTokenRefreshCallCount()).To(Equal(0))
})
})

It("displays the error and all warnings", func() {
Expect(executeErr).NotTo(HaveOccurred())
Expect(testUI.Err).To(Say("steve for all I care"))
Expand Down

0 comments on commit 6270f99

Please sign in to comment.