Files
Dmitri GekhtmanandGitHub ecda14b620 [kuberay] Fix inconsistent RBAC truncation for autoscaling clusters. (#689)
Due to inconsistent truncation of RBAC names, it's not possible to deploy an autoscaling RayService with a long name.
This PR fixes that issue.
Closes #643.

Signed-off-by: Dmitri Gekhtman <[email protected]>
2022-11-04 18:39:04 -07:00

31 lines
627 B
Go

package common
import (
"bytes"
"testing"
"github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"
"github.com/stretchr/testify/assert"
)
// Generate a string of length 200.
func longString(t *testing.T) string {
var b bytes.Buffer
for i := 0; i < 200; i++ {
b.WriteString("a")
}
result := b.String()
// Confirm length.
assert.Equal(t, len(result), 200)
return result
}
// Clip the above string using utils.CheckName
// to a string of length 50.
func shortString(t *testing.T) string {
result := utils.CheckName(longString(t))
// Confirm length.
assert.Equal(t, len(result), 50)
return result
}