mirror of
https://github.com/hanzoai/functions.git
synced 2026-10-30 15:04:37 +00:00
Module github.com/fission/fission -> github.com/hanzoai/functions (288 files). CRD API group fission.io -> hanzo.ai (67 files): functions.hanzo.ai, environments.hanzo.ai, httptriggers.hanzo.ai, messagequeuetriggers.hanzo.ai, joining apps.hanzo.ai under the one house group. Doc URLs preserved. Builds green. Matches the cloud contract: clients/functions, /v1/functions, App CR role "function". Remaining: fork the env images + the live CRD-group migration (demo-only today, low risk).
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package function
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hanzoai/functions/pkg/utils/uuid"
|
|
)
|
|
|
|
func TestGeneratePackageName(t *testing.T) {
|
|
for _, test := range []struct {
|
|
name string
|
|
fnName string
|
|
expected int
|
|
}{
|
|
{
|
|
name: "name of package should be less than or equal to 63 characters, if function name is equal to 26 characters",
|
|
fnName: "test-function-with-26-char",
|
|
expected: 63,
|
|
},
|
|
{
|
|
name: "name of package should be less than or equal to 63 characters, if function name is more than 26 characters",
|
|
fnName: "testfunctionwithmorethan26character",
|
|
expected: 63,
|
|
},
|
|
{
|
|
name: "name of package should be less than or equal to 63 characters, if function name is less than 26 characters",
|
|
fnName: "fission-function",
|
|
expected: 63,
|
|
},
|
|
} {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pkgName := generatePackageName(test.fnName, uuid.NewString())
|
|
if len(pkgName) > test.expected {
|
|
t.Errorf("expected len of package to be %v, got %v", test.expected, len(pkgName))
|
|
}
|
|
})
|
|
}
|
|
}
|