mirror of
https://github.com/outbackdingo/kubernetes.git
synced 2026-02-25 12:20:29 +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:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package create
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
rbac "k8s.io/api/rbac/v1"
|
||||
@@ -72,7 +73,7 @@ func TestCreateRoleBinding(t *testing.T) {
|
||||
}
|
||||
|
||||
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()
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error:\n%#v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user