Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Mock timeout opt in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco authored and stefanprodan committed Aug 20, 2019
1 parent d18267b commit a7b123e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/fluxctl/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/url"
"strings"
"testing"
"time"

"github.com/gorilla/mux"
"github.com/weaveworks/flux/http/client"
Expand All @@ -24,6 +25,7 @@ func mockServiceOpts(trip *genericMockRoundTripper) *rootOpts {
mockAPI := client.New(&c, transport.NewAPIRouter(), "", "")
return &rootOpts{
API: mockAPI,
Timeout: 10*time.Second,
}
}

Expand Down Expand Up @@ -73,9 +75,9 @@ func testArgs(t *testing.T, args []string, shouldErr bool, errMsg string) *gener
cmd.SetArgs(args)
if err := cmd.Execute(); (err == nil) == shouldErr {
if errMsg != "" {
t.Fatal(errMsg)
t.Fatalf("%s: %s", args, errMsg)
} else {
t.Fatal(err)
t.Fatalf("%s: %v", args, err)
}
}
return svc
Expand Down

0 comments on commit a7b123e

Please sign in to comment.