Skip to content

Commit 6b0b64e

Browse files
authored
UI: do not show "create github issue" twice if kubeadm init fails (#21263)
* do not show github issue in exist twice if kubeadm * Reset the flag for each test case
1 parent c4a2e11 commit 6b0b64e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/minikube/out/out.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ var (
6969
spin = spinner.New(spinner.CharSets[style.SpinnerCharacter], 100*time.Millisecond, spinner.WithWriter(outFile))
7070
// defaultBoxCfg is the default style config for cli box output
7171
defaultBoxCfg = box.Config{Py: 1, Px: 4, Type: "Round", Color: "Red"}
72+
// alreadyShoweddGitHubIssueMessage is used to prevent showing the GitHub issue message multiple times
73+
alreadyShoweddGitHubIssueMessage = false
7274
)
7375

7476
// MaxLogEntries controls the number of log entries to show for each source
@@ -477,6 +479,9 @@ func command() (string, error) {
477479
}
478480

479481
func displayGitHubIssueMessage() {
482+
if alreadyShoweddGitHubIssueMessage {
483+
return
484+
}
480485
cmd, err := command()
481486
if err != nil {
482487
klog.Warningf("failed to get command: %v", err)
@@ -496,6 +501,7 @@ func displayGitHubIssueMessage() {
496501
}
497502

498503
BoxedErr(msg)
504+
alreadyShoweddGitHubIssueMessage = true
499505
}
500506

501507
// applyTmpl applies formatting

pkg/minikube/out/out_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ func TestDisplayGitHubIssueMessage(t *testing.T) {
230230
pflag.Parse()
231231
f := tests.NewFakeFile()
232232
SetErrFile(f)
233+
alreadyShoweddGitHubIssueMessage = false // Reset the flag for each test case
233234
displayGitHubIssueMessage()
234235
output := f.String()
235236
if strings.Contains(output, msg) && !tt.shouldContainMessage {

0 commit comments

Comments
 (0)