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
Kubernetes-commit: 1e0bbe61ae4d4e186bc8d0991210d1613dc71996
This commit is contained in:
parent
7663a9f447
commit
4507bdb448
|
|
@ -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