Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya Wadhwa committed Jul 21, 2020
1 parent 8bc875d commit 5c1d06b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/minikube/out/register/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,20 @@ func TestErrorExitCode(t *testing.T) {
}

PrintErrorExitCode("error", 5, map[string]string{"a": "b"}, map[string]string{"c": "d"})
actual := buf.String()
if actual != expected {
t.Fatalf("expected didn't match actual:\nExpected:\n%v\n\nActual:\n%v", expected, actual)
}
}
func TestWarning(t *testing.T) {
expected := `{"data":{"message":"warning"},"datacontenttype":"application/json","id":"random-id","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.warning"}`
expected += "\n"

buf := bytes.NewBuffer([]byte{})
outputFile = buf
defer func() { outputFile = os.Stdout }()
OutputFile = buf
defer func() { OutputFile = os.Stdout }()

getUUID = func() string {
GetUUID = func() string {
return "random-id"
}

Expand Down

0 comments on commit 5c1d06b

Please sign in to comment.