Fix minikube tunnel repeated printout of status
The check to suppress repeated status printout does not work, it compares pointers, while the state is always cloned when it is passed to the Report function. Do the DeepEqual check instead and change the test to be real.pull/14933/head
parent
1d80003313
commit
a5fba12f97
|
@ -18,6 +18,7 @@ package tunnel
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"io"
|
||||
"strings"
|
||||
|
@ -38,7 +39,7 @@ type simpleReporter struct {
|
|||
const noErrors = "no errors"
|
||||
|
||||
func (r *simpleReporter) Report(tunnelState *Status) {
|
||||
if r.lastState == tunnelState {
|
||||
if reflect.DeepEqual(r.lastState, tunnelState) {
|
||||
return
|
||||
}
|
||||
r.lastState = tunnelState
|
||||
|
|
|
@ -103,11 +103,11 @@ Got: "%s"`, tc.name, tc.expectedOutput, out.output)
|
|||
// testing deduplication
|
||||
out := &recordingWriter{}
|
||||
reporter := newReporter(out)
|
||||
reporter.Report(testCases[0].tunnelState)
|
||||
reporter.Report(testCases[0].tunnelState)
|
||||
reporter.Report(testCases[1].tunnelState)
|
||||
reporter.Report(testCases[1].tunnelState)
|
||||
reporter.Report(testCases[0].tunnelState)
|
||||
reporter.Report(testCases[0].tunnelState.Clone())
|
||||
reporter.Report(testCases[0].tunnelState.Clone())
|
||||
reporter.Report(testCases[1].tunnelState.Clone())
|
||||
reporter.Report(testCases[1].tunnelState.Clone())
|
||||
reporter.Report(testCases[0].tunnelState.Clone())
|
||||
|
||||
expectedOutput := fmt.Sprintf("%s%s%s",
|
||||
testCases[0].expectedOutput,
|
||||
|
|
Loading…
Reference in New Issue