use 'errors.Errorf' instead of 'fmt.Errorf'

This commit is contained in:
SataQiu
2019-04-20 17:10:18 +08:00
parent b384712024
commit 62dbd0fa0d
2 changed files with 7 additions and 3 deletions

View File

@@ -45,5 +45,8 @@ go_test(
name = "go_default_test",
srcs = ["token_test.go"],
embed = [":go_default_library"],
deps = ["//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library"],
deps = [
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
],
)

View File

@@ -17,10 +17,11 @@ limitations under the License.
package token
import (
"fmt"
"testing"
"time"
"github.com/pkg/errors"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
)
@@ -71,7 +72,7 @@ func TestFetchKubeConfigWithTimeout(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
cfg, err := fetchKubeConfigWithTimeout(testAPIEndpoint, test.discoveryTimeout, func(apiEndpoint string) (*clientcmdapi.Config, error) {
if apiEndpoint != testAPIEndpoint {
return nil, fmt.Errorf("unexpected API server endpoint:\n\texpected: %q\n\tgot: %q", testAPIEndpoint, apiEndpoint)
return nil, errors.Errorf("unexpected API server endpoint:\n\texpected: %q\n\tgot: %q", testAPIEndpoint, apiEndpoint)
}
time.Sleep(3 * time.Second)