This commit is contained in:
parent
52a3b54ba2
commit
cc42fc394a
5 changed files with 64 additions and 0 deletions
|
@ -607,6 +607,7 @@ func enableRoutes(tx *gorm.DB,
|
|||
}
|
||||
|
||||
func generateGivenName(suppliedName string, randomSuffix bool) (string, error) {
|
||||
suppliedName = util.ConvertWithFQDNRules(suppliedName)
|
||||
if len(suppliedName) > util.LabelHostnameLength {
|
||||
return "", types.ErrHostnameTooLong
|
||||
}
|
||||
|
|
|
@ -392,6 +392,15 @@ func TestHeadscale_generateGivenName(t *testing.T) {
|
|||
want: regexp.MustCompile("^testnode$"),
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "UPPERCASE node name generation",
|
||||
args: args{
|
||||
suppliedName: "TestNode",
|
||||
randomSuffix: false,
|
||||
},
|
||||
want: regexp.MustCompile("^testnode$"),
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "node name with 53 chars",
|
||||
args: args{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue