mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
* support partial sync with namespace. * corrected test folder name * Trying to fix lint error * 1. in test, delete ns after test 2. in test, created new methods for ResourceSyncStatusWithNamespaceIs and ResourceHealthWithNamespaceIs. * reformat imports * simplify code * remove timeout
23 lines
578 B
Go
23 lines
578 B
Go
package fixture
|
|
|
|
import (
|
|
"regexp"
|
|
"strings"
|
|
)
|
|
|
|
var (
|
|
matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)")
|
|
matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])")
|
|
)
|
|
|
|
// returns dns friends string which is no longer than 63 characters and has specified postfix at the end
|
|
func DnsFriendly(str string, postfix string) string {
|
|
str = matchFirstCap.ReplaceAllString(str, "${1}-${2}")
|
|
str = matchAllCap.ReplaceAllString(str, "${1}-${2}")
|
|
str = strings.ToLower(str)
|
|
|
|
if diff := len(str) + len(postfix) - 63; diff > 0 {
|
|
str = str[:len(str)-diff]
|
|
}
|
|
return str + postfix
|
|
}
|