mirror of https://github.com/k3s-io/k3s
Fix format specifiers in Printf-type functions.
parent
e1cb72f1ae
commit
800284164a
|
@ -286,7 +286,7 @@ func TestValidateRestartPolicy(t *testing.T) {
|
|||
}
|
||||
for k, policy := range errorCases {
|
||||
if errs := validateRestartPolicy(&policy); len(errs) == 0 {
|
||||
t.Errorf("expected failure for %s", k)
|
||||
t.Errorf("expected failure for %d", k)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ token2,user2,uid2
|
|||
t.Errorf("%d: expected user %#v, got %#v", i, testCase.User, user)
|
||||
}
|
||||
if testCase.Ok != ok {
|
||||
t.Errorf("%d: expected auth %f, got %f", i, testCase.Ok, ok)
|
||||
t.Errorf("%d: expected auth %v, got %v", i, testCase.Ok, ok)
|
||||
}
|
||||
switch {
|
||||
case err == nil && testCase.Err:
|
||||
|
|
|
@ -49,7 +49,7 @@ func TestAuthenticateRequest(t *testing.T) {
|
|||
|
||||
<-success
|
||||
if len(context.requests) > 0 {
|
||||
t.Errorf("context should have no stored requests", context)
|
||||
t.Errorf("context should have no stored requests: %v", context)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ func TestAuthenticateRequestFailed(t *testing.T) {
|
|||
|
||||
<-failed
|
||||
if len(context.requests) > 0 {
|
||||
t.Errorf("context should have no stored requests", context)
|
||||
t.Errorf("context should have no stored requests: %v", context)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,6 @@ func TestAuthenticateRequestError(t *testing.T) {
|
|||
|
||||
<-failed
|
||||
if len(context.requests) > 0 {
|
||||
t.Errorf("context should have no stored requests", context)
|
||||
t.Errorf("context should have no stored requests: %v", context)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ func TestIsConfigTransportSecure(t *testing.T) {
|
|||
for _, testCase := range testCases {
|
||||
secure := IsConfigTransportSecure(testCase.Config)
|
||||
if testCase.Secure != secure {
|
||||
t.Errorf("expected %d for %#v", testCase.Secure, testCase.Config)
|
||||
t.Errorf("expected %v for %#v", testCase.Secure, testCase.Config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ func TestBearerAuthRoundTripper(t *testing.T) {
|
|||
req := &http.Request{}
|
||||
NewBearerAuthRoundTripper("test", rt).RoundTrip(req)
|
||||
if rt.Request == nil {
|
||||
t.Fatalf("unexpected nil request", rt)
|
||||
t.Fatalf("unexpected nil request: %v", rt)
|
||||
}
|
||||
if rt.Request == req {
|
||||
t.Fatalf("round tripper should have copied request object: %#v", rt.Request)
|
||||
|
@ -60,7 +60,7 @@ func TestBasicAuthRoundTripper(t *testing.T) {
|
|||
req := &http.Request{}
|
||||
NewBasicAuthRoundTripper("user", "pass", rt).RoundTrip(req)
|
||||
if rt.Request == nil {
|
||||
t.Fatalf("unexpected nil request", rt)
|
||||
t.Fatalf("unexpected nil request: %v", rt)
|
||||
}
|
||||
if rt.Request == req {
|
||||
t.Fatalf("round tripper should have copied request object: %#v", rt.Request)
|
||||
|
|
|
@ -85,7 +85,7 @@ func TestOVirtCloudXmlParsing(t *testing.T) {
|
|||
t.Fatalf("Unexpected error listing instances: %s", err3)
|
||||
}
|
||||
if len(instances3) > 0 {
|
||||
t.Fatalf("Unexpected number of instance(s): %i", len(instances3))
|
||||
t.Fatalf("Unexpected number of instance(s): %d", len(instances3))
|
||||
}
|
||||
|
||||
body4 := strings.NewReader(`
|
||||
|
@ -116,7 +116,7 @@ func TestOVirtCloudXmlParsing(t *testing.T) {
|
|||
t.Fatalf("Unexpected error listing instances: %s", err4)
|
||||
}
|
||||
if len(instances4) != 2 {
|
||||
t.Fatalf("Unexpected number of instance(s): %i", len(instances4))
|
||||
t.Fatalf("Unexpected number of instance(s): %d", len(instances4))
|
||||
}
|
||||
if instances4[0] != "host1" || instances4[1] != "host3" {
|
||||
t.Fatalf("Unexpected instance(s): %s", instances4)
|
||||
|
|
|
@ -112,7 +112,7 @@ func (v *VagrantCloud) IPAddress(instance string) (net.IP, error) {
|
|||
return net.ParseIP(minion.IP), nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("Unable to find IP address for instance:", instance)
|
||||
return nil, fmt.Errorf("Unable to find IP address for instance: %s", instance)
|
||||
}
|
||||
|
||||
// saltMinionsByRole filters a list of minions that have a matching role.
|
||||
|
|
|
@ -27,7 +27,7 @@ func TestResolvePortInt(t *testing.T) {
|
|||
expected := 80
|
||||
port, err := ResolvePort(util.IntOrString{Kind: util.IntstrInt, IntVal: expected}, &api.Container{})
|
||||
if port != expected {
|
||||
t.Errorf("expected: %d, saw: %d", port)
|
||||
t.Errorf("expected: %d, saw: %d", expected, port)
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
|
@ -44,7 +44,7 @@ func TestResolvePortString(t *testing.T) {
|
|||
}
|
||||
port, err := ResolvePort(util.IntOrString{Kind: util.IntstrString, StrVal: name}, container)
|
||||
if port != expected {
|
||||
t.Errorf("expected: %d, saw: %d", port)
|
||||
t.Errorf("expected: %d, saw: %d", expected, port)
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
|
|
|
@ -191,10 +191,10 @@ func TestRequiresExactMatch(t *testing.T) {
|
|||
for k, v := range testCases {
|
||||
value, found := v.S.RequiresExactMatch(v.Label)
|
||||
if value != v.Value {
|
||||
t.Errorf("%s: expected value %s, got %s", k, v.Value, value)
|
||||
t.Errorf("%s: expected value %v, got %s", k, v.Value, value)
|
||||
}
|
||||
if found != v.Found {
|
||||
t.Errorf("%s: expected found %s, got %s", k, v.Found, found)
|
||||
t.Errorf("%s: expected found %v, got %s", k, v.Found, found)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ func TestIPSub(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
r := ipSub(net.ParseIP(tc.lhs), net.ParseIP(tc.rhs))
|
||||
if r != tc.expected {
|
||||
t.Errorf("Expected %s, got %s", tc.expected, r)
|
||||
t.Errorf("Expected %v, got %v", tc.expected, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ func TestServiceRegistryCreate(t *testing.T) {
|
|||
t.Errorf("Expected foo, but got %v", created_service.ID)
|
||||
}
|
||||
if created_service.CreationTimestamp.IsZero() {
|
||||
t.Errorf("Expected timestamp to be set, got %:v", created_service.CreationTimestamp)
|
||||
t.Errorf("Expected timestamp to be set, got: %v", created_service.CreationTimestamp)
|
||||
}
|
||||
if len(fakeCloud.Calls) != 0 {
|
||||
t.Errorf("Unexpected call(s): %#v", fakeCloud.Calls)
|
||||
|
|
|
@ -79,7 +79,7 @@ func TestGetInteger(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
val := GetIntegerResource(test.res, test.name, test.def)
|
||||
if val != test.expected {
|
||||
t.Errorf("%s: expected: %d found %d", test.expected, val)
|
||||
t.Errorf("expected: %d found %d", test.expected, val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ func TestGetFloat(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
val := GetFloatResource(test.res, test.name, test.def)
|
||||
if val != test.expected {
|
||||
t.Errorf("%s: expected: %d found %d", test.expected, val)
|
||||
t.Errorf("%expected: %d found %d", test.expected, val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ func TestGetString(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
val := GetStringResource(test.res, test.name, test.def)
|
||||
if val != test.expected {
|
||||
t.Errorf("%s: expected: %d found %d", test.expected, val)
|
||||
t.Errorf("expected: %d found %d", test.expected, val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ func TestResourceVersionerOfAPI(t *testing.T) {
|
|||
t.Errorf("%s: unexpected error %#v", key, err)
|
||||
}
|
||||
if actual != testCase.Expected {
|
||||
t.Errorf("%s: expected %d, got %d", key, testCase.Expected, actual)
|
||||
t.Errorf("%s: expected %v, got %v", key, testCase.Expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ func TestResourceVersionerOfAPI(t *testing.T) {
|
|||
t.Errorf("%s: unexpected error %#v", key, err)
|
||||
}
|
||||
if actual != "5" {
|
||||
t.Errorf("%s: expected %d, got %d", key, "5", actual)
|
||||
t.Errorf("%s: expected %v, got %v", key, "5", actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ func TestPodFitsPorts(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
fits, err := PodFitsPorts(test.pod, test.existingPods, "machine")
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v")
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if test.fits != fits {
|
||||
t.Errorf("%s: expected %v, saw %v", test.test, test.fits, fits)
|
||||
|
|
|
@ -452,7 +452,7 @@ func TestWatchFromZeroIndex(t *testing.T) {
|
|||
t.Fatalf("%s: expected a pod, got %#v", k, event.Object)
|
||||
}
|
||||
if actualPod.ResourceVersion != testCase.ExpectedVersion {
|
||||
t.Errorf("%s: expected pod with resource version %d, Got %#v", k, testCase.ExpectedVersion, actualPod)
|
||||
t.Errorf("%s: expected pod with resource version %v, Got %#v", k, testCase.ExpectedVersion, actualPod)
|
||||
}
|
||||
pod.ResourceVersion = testCase.ExpectedVersion
|
||||
if e, a := pod, event.Object; !reflect.DeepEqual(e, a) {
|
||||
|
|
Loading…
Reference in New Issue