Merge pull request #14933 from oldium/fix-tunnel-reporting

Fix minikube tunnel repeated printout of status
pull/15216/head
Steven Powell 2022-10-24 15:49:40 -07:00 committed by GitHub
commit d0a07b75b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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,