Repository: kubernetes/minikube
Pull request #14933 (2022-09-09 17:04:45)

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.

<!-- 🎉 Thank you for contributing to minikube! 🎉 Here are some hints to get your PR merged faster:

1. Your PR title will be included in the release notes, choose it carefully
2. If the PR fixes an issue, add "fixes #<issue number>" to the description.
3. If the PR is a user interface change, please include a "before" and "after" example.
4. If the PR is a large design change, please include an enhancement proposal:
https://github.com/kubernetes/minikube/tree/master/enhancements
-->


k8s-ci-robot: Hi @oldium. Thanks for your PR.

I'm waiting for a [kubernetes](https://github.com/orgs/kubernetes/people) member to verify that this patch is reasonable to test. If it is, they should reply with `/ok-to-test` on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should [join the org](https://git.k8s.io/community/community-membership.md#member) to skip this step.

Once the patch is verified, the new status will be reflected by the `ok-to-test` label.

I understand the commands that are listed [here](https://go.k8s.io/bot-commands?repo=kubernetes%2Fminikube).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
</details>

k8s-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes/minikube/pull/14933#" title="Author self-approved">oldium</a>*
**Once this PR has been reviewed and has the lgtm label**, please assign medyagh for approval by writing `/assign @medyagh` in a comment. For more information see:[The Kubernetes Code Review Process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process).

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes%2Fminikube).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/kubernetes/minikube/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["medyagh"]} -->

Patch:
diff --git a/pkg/minikube/tunnel/reporter.go b/pkg/minikube/tunnel/reporter.go
index a1ee16b8b..8535a7dcd 100644
--- a/pkg/minikube/tunnel/reporter.go
+++ b/pkg/minikube/tunnel/reporter.go
@@ -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


Test patch:
diff --git a/pkg/minikube/tunnel/reporter_test.go b/pkg/minikube/tunnel/reporter_test.go
index 8cdb27d57..d5dbbd0a1 100644
--- a/pkg/minikube/tunnel/reporter_test.go
+++ b/pkg/minikube/tunnel/reporter_test.go
@@ -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,