mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-23 10:32:03 +00:00
replace string casting with fmt.sprintf in test
in: staging/src/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go test: TestCreateRoleBinding On go version 1.15.3, casting int to string using `string(int)` causes the test to fail with this error: >> k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/create vendor/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go:75:9: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?) FAIL k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/create [build failed] FAIL make: *** [Makefile:185: test] Error 1
This commit is contained in:
parent
acc3910964
commit
1e0bbe61ae
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package create
|
package create
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
rbac "k8s.io/api/rbac/v1"
|
rbac "k8s.io/api/rbac/v1"
|
||||||
@ -72,7 +73,7 @@ func TestCreateRoleBinding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range tests {
|
for i, tc := range tests {
|
||||||
t.Run(string(i), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||||
roleBinding, err := tc.options.createRoleBinding()
|
roleBinding, err := tc.options.createRoleBinding()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error:\n%#v\n", err)
|
t.Errorf("unexpected error:\n%#v\n", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user